| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| Kernel32 |
|
| 0.0;0 |
| 1 | /* | |
| 2 | * Copyright 2004-2008 the Seasar Foundation and the Others. | |
| 3 | * | |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); | |
| 5 | * you may not use this file except in compliance with the License. | |
| 6 | * You may obtain a copy of the License at | |
| 7 | * | |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 | |
| 9 | * | |
| 10 | * Unless required by applicable law or agreed to in writing, software | |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, | |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, | |
| 13 | * either express or implied. See the License for the specific language | |
| 14 | * governing permissions and limitations under the License. | |
| 15 | */ | |
| 16 | package org.seasar.uruma.util.win32; | |
| 17 | ||
| 18 | import java.nio.Buffer; | |
| 19 | ||
| 20 | import nlink.Holder; | |
| 21 | import nlink.MarshalAs; | |
| 22 | import nlink.NativeType; | |
| 23 | import nlink.win32.CheckLastError; | |
| 24 | import nlink.win32.DllClass; | |
| 25 | import nlink.win32.DllMethod; | |
| 26 | ||
| 27 | /** | |
| 28 | * kernel32.dll の提供する API をラップするためのインターフェースです。<br /> | |
| 29 | * | |
| 30 | * @author y-komori | |
| 31 | */ | |
| 32 | @DllClass | |
| 33 | public interface Kernel32 { | |
| 34 | // SetErrorMode 用の定数 | |
| 35 | /** | |
| 36 | * 致命的なエラーに関するメッセージボックスを表示しません。 | |
| 37 | */ | |
| 38 | static final int SEM_FAILCRITICALERRORS = 0x0001; | |
| 39 | ||
| 40 | /** | |
| 41 | * メモリ整列の違反を自動的に修復します。x86 プロセッサでは効果がありません。 | |
| 42 | */ | |
| 43 | static final int SEM_NOALIGNMENTFAULTEXCEPT = 0x0002; | |
| 44 | ||
| 45 | /** | |
| 46 | * 一般保護違反メッセージボックスを表示しません。 | |
| 47 | */ | |
| 48 | static final int SEM_NOGPFAULTERRORBOX = 0x0004; | |
| 49 | ||
| 50 | /** | |
| 51 | * ファイルが見つからなかった場合にメッセージボックスを表示しません。 | |
| 52 | */ | |
| 53 | static final int SEM_NOOPENFILEERRORBOX = 0x8000; | |
| 54 | ||
| 55 | // GetDriveType 用の定数 | |
| 56 | /** | |
| 57 | * ドライブの種類を判別できませんでした。 | |
| 58 | */ | |
| 59 | static final int DRIVE_UNKNOWN = 0; | |
| 60 | ||
| 61 | /** | |
| 62 | * 指定のルートディレクトリが存在しません。<br /> | |
| 63 | * たとえば、パスにボリュームがマウントされていません。<br /> | |
| 64 | * (未フォーマットや、メディアが挿入されていないなど)。 | |
| 65 | */ | |
| 66 | static final int DRIVE_NO_ROOT_DIR = 1; | |
| 67 | ||
| 68 | /** | |
| 69 | * このディスクは、ドライブから取り出せます。 | |
| 70 | */ | |
| 71 | static final int DRIVE_REMOVABLE = 2; | |
| 72 | ||
| 73 | /** | |
| 74 | * このディスクは、ドライブから取り出せません。 | |
| 75 | */ | |
| 76 | static final int DRIVE_FIXED = 3; | |
| 77 | ||
| 78 | /** | |
| 79 | * このドライブは、リモート(ネットワーク)ドライブです。 | |
| 80 | */ | |
| 81 | static final int DRIVE_REMOTE = 4; | |
| 82 | ||
| 83 | /** | |
| 84 | * このドライブは、CD-ROM ドライブです。 | |
| 85 | */ | |
| 86 | static final int DRIVE_CDROM = 5; | |
| 87 | ||
| 88 | /** | |
| 89 | * このドライブは、RAM ディスクです。 | |
| 90 | */ | |
| 91 | static final int DRIVE_RAMDISK = 6; | |
| 92 | ||
| 93 | /** | |
| 94 | * @see <a | |
| 95 | * href="http://msdn.microsoft.com/library/ja/jpsysinf/html/_win32_getcomputername.asp">GetComputerName</a> | |
| 96 | */ | |
| 97 | @DllMethod | |
| 98 | @CheckLastError | |
| 99 | int GetComputerName(@MarshalAs(NativeType.PVOID) | |
| 100 | Buffer buffer, @MarshalAs(NativeType.Int32_ByRef) | |
| 101 | Holder<Integer> size); | |
| 102 | ||
| 103 | /** | |
| 104 | * @see <a | |
| 105 | * href="http://msdn.microsoft.com/library/ja/jpfileio/html/_win32_getlogicaldrives.asp">GetLogicalDrives</a> | |
| 106 | */ | |
| 107 | @DllMethod | |
| 108 | @CheckLastError | |
| 109 | int GetLogicalDrives(); | |
| 110 | ||
| 111 | /** | |
| 112 | * @see <a | |
| 113 | * href="http://msdn.microsoft.com/library/ja/jpfileio/html/_win32_getvolumeinformation.asp">GetVolumeInformation</a> | |
| 114 | */ | |
| 115 | @DllMethod | |
| 116 | int GetVolumeInformation(String rootPathName, @MarshalAs(NativeType.PVOID) | |
| 117 | Buffer volumeNameBuffer, int volumeNameSize, | |
| 118 | @MarshalAs(NativeType.Int32_ByRef) | |
| 119 | Holder<Integer> volumeSerialNumber, | |
| 120 | @MarshalAs(NativeType.Int32_ByRef) | |
| 121 | Holder<Integer> maximumComponentLength, | |
| 122 | @MarshalAs(NativeType.Int32_ByRef) | |
| 123 | Holder<Integer> fileSystemFlags, @MarshalAs(NativeType.PVOID) | |
| 124 | Buffer fileSystemNameBuffer, int fileSystemNameSize); | |
| 125 | ||
| 126 | /** | |
| 127 | * @see <a | |
| 128 | * href="http://msdn.microsoft.com/library/ja/jpfileio/html/_win32_getdrivetype.asp">GetDriveType</a> | |
| 129 | */ | |
| 130 | @DllMethod | |
| 131 | int GetDriveType(String rootPathName); | |
| 132 | ||
| 133 | /** | |
| 134 | * @see <a | |
| 135 | * href="http://msdn.microsoft.com/library/ja/jpdebug/html/_win32_seterrormode.asp">SetErrorMode</a> | |
| 136 | */ | |
| 137 | @DllMethod | |
| 138 | @CheckLastError | |
| 139 | int SetErrorMode(int mode); | |
| 140 | ||
| 141 | /** | |
| 142 | * @see <a | |
| 143 | * href="http://msdn.microsoft.com/library/ja/jpdebug/html/_win32_getlasterror.asp">GetLastError</a> | |
| 144 | */ | |
| 145 | @DllMethod | |
| 146 | @CheckLastError | |
| 147 | int GetLastError(); | |
| 148 | } |