vdfsplat / AppSrc / cWinKernEx.H @ 67
History | View | Annotate | Download (15.7 KB)
1 | 14 | wil | // cWinKernEx.h
|
---|---|---|---|
2 | // By Sergey V. Natarov (senatc@postman.ru)
|
||
3 | // Windows Kernel Interface
|
||
4 | //
|
||
5 | |||
6 | Define MAX_COMPUTERNAME_LENGTH For 15
|
||
7 | |||
8 | #IF (FMAC_VERSION < 8) |
||
9 | Define SYNCHRONIZE For |CI$00100000
|
||
10 | Define NOTSYNCHRONIZE For |CI$FFEFFFFF |
||
11 | Define STANDARD_RIGHTS_REQUIRED For |CI$000F0000 |
||
12 | #ENDIF
|
||
13 | |||
14 | // Drive types
|
||
15 | Define DRIVE_UNKNOWN For 0
|
||
16 | Define DRIVE_NO_ROOT_DIR For 1
|
||
17 | Define DRIVE_REMOVABLE For 2
|
||
18 | Define DRIVE_FIXED For 3
|
||
19 | Define DRIVE_REMOTE For 4
|
||
20 | Define DRIVE_CDROM For 5
|
||
21 | Define DRIVE_RAMDISK For 6
|
||
22 | |||
23 | Define PROCESS_TERMINATE For |CI$0001
|
||
24 | Define PROCESS_CREATE_THREAD For |CI$0002
|
||
25 | Define PROCESS_SET_SESSIONID For |CI$0004
|
||
26 | Define PROCESS_VM_OPERATION For |CI$0008 |
||
27 | Define PROCESS_VM_READ For |CI$0010
|
||
28 | Define PROCESS_VM_WRITE For |CI$0020
|
||
29 | Define PROCESS_DUP_HANDLE For |CI$0040
|
||
30 | Define PROCESS_CREATE_PROCESS For |CI$0080
|
||
31 | Define PROCESS_SET_QUOTA For |CI$0100
|
||
32 | Define PROCESS_SET_INFORMATION For |CI$0200
|
||
33 | Define PROCESS_QUERY_INFORMATION For |CI$0400
|
||
34 | Define PROCESS_ALL_ACCESS For (STANDARD_RIGHTS_REQUIRED Ior SYNCHRONIZE Ior |CI$FFFF) |
||
35 | |||
36 | Define FORMAT_MESSAGE_ALLOCATE_BUFFER For |CI$00000100
|
||
37 | Define FORMAT_MESSAGE_IGNORE_INSERTS For |CI$00000200
|
||
38 | Define FORMAT_MESSAGE_FROM_STRING For |CI$00000400
|
||
39 | Define FORMAT_MESSAGE_FROM_HMODULE For |CI$00000800 |
||
40 | Define FORMAT_MESSAGE_FROM_SYSTEM For |CI$00001000
|
||
41 | Define FORMAT_MESSAGE_ARGUMENT_ARRAY For |CI$00002000
|
||
42 | Define FORMAT_MESSAGE_MAX_WIDTH_MASK For |CI$000000FF |
||
43 | |||
44 | Type _OSVERSIONINFO |
||
45 | Field _OSVERSIONINFO.dwOSVersionInfoSize As dWord |
||
46 | Field _OSVERSIONINFO.dwMajorVersion As dWord |
||
47 | Field _OSVERSIONINFO.dwMinorVersion As dWord |
||
48 | Field _OSVERSIONINFO.dwBuildNumber As dWord |
||
49 | Field _OSVERSIONINFO.dwPlatformId As dWord |
||
50 | Field _OSVERSIONINFO.szCSDVersion As Char 128
|
||
51 | End_Type // _OSVERSIONINFO
|
||
52 | |||
53 | // GetVersionEx constants
|
||
54 | |||
55 | Enumeration_List |
||
56 | Define CP_VER_PLATFORM_WIN32s // Win32s on Windows 3.1.
|
||
57 | Define CP_VER_PLATFORM_WIN32_WINDOWS // Win32 on Windows 95.
|
||
58 | Define CP_VER_PLATFORM_WIN32_NT // Win32 on Windows NT, 2000, XP and 2003
|
||
59 | End_Enumeration_List |
||
60 | |||
61 | Enumeration_List |
||
62 | Define Ver_MajorVersion_Windows_95 For 4
|
||
63 | Define Ver_MajorVersion_Windows_98 For 4
|
||
64 | Define Ver_MajorVersion_Windows_Me For 4
|
||
65 | Define Ver_MajorVersion_Windows_NT_351 For 3
|
||
66 | Define Ver_MajorVersion_Windows_NT_40 For 4
|
||
67 | Define Ver_MajorVersion_Windows_2000 For 5
|
||
68 | Define Ver_MajorVersion_Windows_XP For 5
|
||
69 | Define Ver_MajorVersion_Windows_NET_Server For 5
|
||
70 | End_Enumeration_List |
||
71 | |||
72 | Enumeration_List |
||
73 | Define Ver_MinorVersion_Windows_95 For 0
|
||
74 | Define Ver_MinorVersion_Windows_98 For 10
|
||
75 | Define Ver_MinorVersion_Windows_Me For 90
|
||
76 | Define Ver_MinorVersion_Windows_NT_351 For 51
|
||
77 | Define Ver_MinorVersion_Windows_NT_40 For 0
|
||
78 | Define Ver_MinorVersion_Windows_2000 For 0
|
||
79 | Define Ver_MinorVersion_Windows_XP For 1
|
||
80 | Define Ver_MinorVersion_Windows_NET_Server For 1
|
||
81 | End_Enumeration_List |
||
82 | |||
83 | |||
84 | Enumeration_List |
||
85 | Define Ver_Suite_SmallBusiness For |CI$0001
|
||
86 | Define Ver_Suite_Enterprise For |CI$0002
|
||
87 | Define Ver_Suite_BackOffice For |CI$0004
|
||
88 | Define Ver_Suite_Communications For |CI$0008 |
||
89 | Define Ver_Suite_Terminal For |CI$0010
|
||
90 | Define Ver_Suite_SmallBusiness_Restricted For |CI$0020
|
||
91 | Define Ver_Suite_EmbeddedNT For |CI$0040
|
||
92 | Define Ver_Suite_DataCenter For |CI$0080
|
||
93 | Define Ver_Suite_SingleUserTS For |CI$0100
|
||
94 | Define Ver_Suite_Personal For |CI$0200
|
||
95 | Define Ver_Suite_Blade For |CI$0400
|
||
96 | Define Ver_Suite_Storage_Server For |CI$2000
|
||
97 | Define Ver_Suite_WH_Server For |CI$8000
|
||
98 | End_Enumeration_List |
||
99 | |||
100 | |||
101 | Enumeration_List |
||
102 | Define VER_NT_WORKSTATION For 1 // The system is running Windows NT 4.0 Workstation, |
||
103 | // Windows 2000 Professional, Windows XP Home Edition, or
|
||
104 | // Windows XP Professional.
|
||
105 | Define VER_NT_DOMAIN_CONTROLLER For 2 // The system is a domain controller. |
||
106 | Define VER_NT_SERVER For 3 // The system is a server. |
||
107 | End_Enumeration_List |
||
108 | |||
109 | |||
110 | Type _OSVERSIONINFOEX |
||
111 | Field _OSVERSIONINFOEX.dwOSVersionInfoSize As dWord |
||
112 | Field _OSVERSIONINFOEX.dwMajorVersion As dWord |
||
113 | Field _OSVERSIONINFOEX.dwMinorVersion As dWord |
||
114 | Field _OSVERSIONINFOEX.dwBuildNumber As dWord |
||
115 | Field _OSVERSIONINFOEX.dwPlatformId As dWord |
||
116 | Field _OSVERSIONINFOEX.szCSDVersion As Char 128
|
||
117 | Field _OSVERSIONINFOEX.wServicePackMajor As Word |
||
118 | Field _OSVERSIONINFOEX.wServicePackMinor As Word |
||
119 | Field _OSVERSIONINFOEX.wSuiteMask As Word |
||
120 | Field _OSVERSIONINFOEX.wProductType As Byte |
||
121 | Field _OSVERSIONINFOEX.wReserved As Byte |
||
122 | End_Type // _OSVERSIONINFOEX
|
||
123 | |||
124 | |||
125 | // 2004-05-24 ------------------------------------ Start Nils G. Svedmyr
|
||
126 | //#IFDEF MEMORYSTATUS_SIZE
|
||
127 | // #ELSE
|
||
128 | // DEFINE$VARIABLE$HELP INTEGER MEMORYSTATUS_SIZE
|
||
129 | //#ENDIF
|
||
130 | |||
131 | //#IF (MEMORYSTATUS_SIZE = |CI0)
|
||
132 | // Type MEMORYSTATUS
|
||
133 | // Field MEMORYSTATUS.dwLength As DWord // sizeof(MEMORYSTATUS)
|
||
134 | // Field MEMORYSTATUS.dwMemoryLoad As DWord // percent of memory in use
|
||
135 | // Field MEMORYSTATUS.dwTotalPhys As DWord // bytes of physical memory
|
||
136 | // Field MEMORYSTATUS.dwAvailPhys As DWord // free physical memory bytes
|
||
137 | // Field MEMORYSTATUS.dwTotalPageFile As DWord // bytes of paging file
|
||
138 | // Field MEMORYSTATUS.dwAvailPageFile As DWord // free bytes of paging file
|
||
139 | // Field MEMORYSTATUS.dwTotalVirtual As DWord // user bytes of address space
|
||
140 | // Field MEMORYSTATUS.dwAvailVirtual As DWord // free user bytes
|
||
141 | // End_Type // MEMORYSTATUS
|
||
142 | //#ENDIF
|
||
143 | // 2004-05-24 ------------------------------------ Stop Nils G. Svedmyr
|
||
144 | |||
145 | External_Function GetTempPathEf "GetTempPathA" Kernel32.Dll Integer nBufferLength Pointer lpBuffer Returns Integer
|
||
146 | External_Function GetSystemTimeEf "GetSystemTime" Kernel32.dll Pointer lpSystemTime Returns Integer
|
||
147 | External_Function CreateProcessEf "CreateProcessA" Kernel32.dll ;
|
||
148 | Pointer ApplicationName ; |
||
149 | Pointer CmdLine ; |
||
150 | Pointer ProcessAttr ; //Struct
|
||
151 | Pointer ThreadAttr ; //Struct
|
||
152 | Integer InheritHandles ; |
||
153 | Integer CreationFlags ; |
||
154 | Integer EnvironmentBlock ; |
||
155 | Pointer CurrentDirectory ; |
||
156 | Pointer StartupInfo ; //Struct
|
||
157 | Pointer ProcessInformation ;//Struct
|
||
158 | Returns Integer |
||
159 | |||
160 | External_Function GetEnvironmentStringsEf "GetEnvironmentStringsA" Kernel32.dll Returns Pointer
|
||
161 | External_Function FreeEnvironmentStringsEf "FreeEnvironmentStringsA" Kernel32.dll Pointer lpEnvBlock Returns Integer
|
||
162 | External_Function MyCreateProcessEf "CreateProcessA" Kernel32.dll ;
|
||
163 | Pointer A ; |
||
164 | Pointer C ; |
||
165 | Pointer P ; |
||
166 | Pointer T ; |
||
167 | Integer I ; |
||
168 | Integer Cr ; |
||
169 | Integer E ; |
||
170 | Pointer Cu ; |
||
171 | Pointer S ; |
||
172 | Pointer Pr ; |
||
173 | Returns Integer |
||
174 | |||
175 | External_Function SleepMilliEf "Sleep" Kernel32.dll UInteger dwMillisecond Returns Integer
|
||
176 | External_Function WaitForSingleObjectEf "WaitForSingleObject" Kernel32.dll Handle hHandle Integer msec Returns Integer
|
||
177 | External_Function CloseHandleEf "CloseHandle" Kernel32.dll Handle hHandle Returns Integer
|
||
178 | |||
179 | External_Function GetExitCodeProcessEf "GetExitCodeProcess" Kernel32.dll Handle hProcess Pointer lpLong Returns Integer
|
||
180 | External_Function ExitProcessEf "ExitProcess" Kernel32.dll Integer iExitCode Returns Integer
|
||
181 | External_Function GetCurrentProcessEf "GetCurrentProcess" Kernel32.dll Returns Handle
|
||
182 | External_Function TerminateProcessEf "TerminateProcess" Kernel32.dll Handle hProcess Integer uExitCode Returns Integer
|
||
183 | External_Function FindExecutableEf "FindExecutableA" Shell32.dll String sFileName String sDefaultDir Pointer lpBuffer Returns Integer
|
||
184 | |||
185 | External_Function InitAtomTableEf "InitAtomTable" kernel32.dll Integer nSize Returns Integer
|
||
186 | External_Function GlobalAddAtomEf "GlobalAddAtomA" kernel32.dll Pointer lpsString Returns Integer
|
||
187 | External_Function GlobalDeleteAtomEf "GlobalDeleteAtom" kernel32.dll Integer nAtom Returns Integer
|
||
188 | External_Function GlobalFindAtomEf "GlobalFindAtomA" kernel32.dll Pointer lpsString Returns Integer
|
||
189 | External_Function GlobalGetAtomNameEf "GlobalGetAtomNameA" kernel32.dll Integer nAtom Pointer lpBuffer Integer nSize Returns Integer
|
||
190 | External_Function CompareFileTimeEf "CompareFileTime" kernel32.dll Pointer lpFileTime1 Pointer lpFileTime2 Returns Integer
|
||
191 | |||
192 | External_Function lcloseEf "_lclose" kernel32.dll Handle hFile Returns Integer
|
||
193 | External_Function lCreatEf "_lcreat" kernel32.dll String lpPathName Integer iAttribute Returns Handle
|
||
194 | External_Function llseekEf "_llseek" kernel32.dll Handle hFile Integer lOffset Integer iOrigin Returns Integer
|
||
195 | External_Function lopenEf "_lopen" kernel32.dll String lpPathName Integer iReadWrite Returns Handle
|
||
196 | External_Function lreadEf "_lread" kernel32.dll Handle hFile Pointer lpBuffer Integer wBytes Returns Integer
|
||
197 | External_Function lwriteEf "_lwrite" kernel32.dll Handle hFile Pointer lpBuffer Integer wBytes Returns Integer
|
||
198 | External_Function lstrcpyEf "lstrcpyA" kernel32.dll Pointer lpString1 Pointer lpString2 Returns Integer
|
||
199 | |||
200 | External_Function GetTempFileNameEf "GetTempFileNameA" kernel32.dll String sPath String sPrefix Integer sUnique Pointer sLoad Returns Integer
|
||
201 | External_Function GetTmpPathEf "GetTempPathA" kernel32.dll Integer iBufferSize Pointer sBuffer Returns Integer
|
||
202 | |||
203 | External_Function FindFirstFileEf "FindFirstFileA" kernel32.dll Pointer lpFileName Pointer pWin32 Returns Handle
|
||
204 | External_Function FindNextFileEf "FindNextFileA" kernel32.dll Handle hSearch Pointer pWin32 Returns Integer
|
||
205 | External_Function FindCloseEf "FindClose" kernel32.dll Handle hSearch Returns Integer
|
||
206 | External_Function xtCopyFileEf "CopyFileA" kernel32.dll String sFileName String sNewFileName Integer bFailIfExists Returns Integer
|
||
207 | External_Function MoveFileEf "MoveFileA" kernel32.dll String szExistingFilename String szNewFilename Returns Integer
|
||
208 | |||
209 | External_Function GlobalAllocEf "GlobalAlloc" kernel32.dll Integer wFlags Integer dwBytes Returns Handle
|
||
210 | External_Function GlobalFreeEf "GlobalFree" kernel32.dll Handle hMem Returns Integer
|
||
211 | External_Function GlobalLockEf "GlobalLock" kernel32.dll Handle hMem Returns Integer
|
||
212 | External_Function GlobalUnlockEf "GlobalUnlock" kernel32.dll Handle hMem Returns Integer
|
||
213 | |||
214 | External_Function SetLastErrorEf "SetLastError" kernel32.dll Integer dwErrorCode Returns Integer
|
||
215 | External_Function GetCurrentProcessIDEf "GetCurrentProcessId" kernel32.dll Returns Address // should be DWord or uinteger |
||
216 | External_Function OpenProcessEf "OpenProcess" Kernel32.Dll Integer dwDesiredAccess Boolean bInheritHandle Integer dwProcessId Returns Handle
|
||
217 | External_Function GetModuleFileNameEf "GetModuleFileNameA" Kernel32.dll Handle hModule Address sFilename UInteger nSize Returns Integer
|
||
218 | |||
219 | External_Function GetLocaleInfoEf "GetLocaleInfoA" Kernel32.dll Integer LCID Integer LCTYPE Pointer lpLCDATA Integer cchData Returns Integer
|
||
220 | External_Function GetCalendarInfoEf "GetCalendarInfoA" Kernel32.Dll Integer iLocale Integer iCalendar Integer iCaltype Pointer lpCalData Integer cchData Pointer lpValue Returns Integer
|
||
221 | |||
222 | External_Function GlobalMemoryStatusEf "GlobalMemoryStatus" Kernel32.Dll Pointer lpsMemoryStatus Returns Integer
|
||
223 | External_Function GetLogicalDriveStringsEf "GetLogicalDriveStringsA" Kernel32.Dll Integer nBufferLength Pointer lpBuffer Returns Integer
|
||
224 | External_Function GetDriveTypeEf "GetDriveTypeA" Kernel32.Dll Pointer lpRootPathName Returns Integer
|
||
225 | |||
226 | External_Function GetVolumeInformationEf "GetVolumeInformationA" Kernel32.DLL ;
|
||
227 | Pointer lpRootPathName Pointer lpVolumeNameBuffer Integer nVolumeNameSize Pointer lpVolumeSerialNumber Pointer lpMaximumComponentLength ; |
||
228 | Pointer lpFileSystemFlags Pointer lpFileSystemNameBuffer Integer nFileSystemNameSize Returns Integer |
||
229 | |||
230 | External_Function SetVolumeLabelEf "SetVolumeLabelA" Kernel32.dll Pointer lpRootPathName Pointer lpVolumeName Returns Integer
|
||
231 | |||
232 | External_Function GetDiskFreeSpaceExEf "GetDiskFreeSpaceExA" Kernel32.dll Pointer lpDirectoryName Pointer lpFreeBytesAvailable Pointer lpTotalNumberOfBytes Pointer lpTotalNumberOfFreeBytes Returns Integer
|
||
233 | |||
234 | External_Function GetOSVersionExEf "GetVersionExA" KERNEL32.DLL Pointer lpVersionInformation Returns Integer
|
||
235 | |||
236 | External_Function GetShortPathNameEf "GetShortPathNameA" Kernel32.Dll Pointer lpszLongPath Pointer lpszShortPath DWord cchBuffer Returns Dword
|
||
237 | External_Function GetLongPathNameEf "GetLongPathNameA" Kernel32.Dll Pointer lpszShortPath Pointer lpszLongPath DWord cchBuffer Returns Integer
|
||
238 | |||
239 | External_Function GetComputerNameEf "GetComputerNameA" Kernel32.Dll Pointer lpComputerName DWord nNameSize Returns Integer
|
||
240 | |||
241 | External_Function GetWindowsDirectoryEf "GetWindowsDirectoryA" kernel32.dll Pointer lpBuffer Integer nSize Returns Integer
|
||
242 | External_Function GetSystemDirectoryEf "GetSystemDirectoryA" Kernel32.Dll Pointer lpBuffer UInteger uSize Returns Integer
|
||
243 | External_Function GetCurrentDirectoryEf "GetCurrentDirectoryA" kernel32.dll Integer nSize Pointer lpBuffer Returns Integer
|
||
244 | |||
245 | |||
246 | External_Function CreatefileEf "CreateFileA" kernel32.dll Pointer lpFile DWord dwDesAccess DWord dwShare Pointer lpSecAtt DWord dwCrDisp DWord dwFlags Handle hTempFile Returns Integer
|
||
247 | External_Function FormatMessageEf "FormatMessageA" kernel32.dll Integer dwFlags Pointer lpSrc Integer dwMsgId Integer dwLngId Pointer lpBuf Integer nSize Pointer Arg Returns Integer
|
||
248 | External_Function ReadFileEf "ReadFile" kernel32.dll Handle hFile Pointer lpBuffer DWord nBytesToRead Pointer lpBytesRead Pointer lpOverlapped Returns Integer
|
||
249 | External_Function WriteFileEf "WriteFile" kernel32.dll Handle hFile Pointer lpBuf DWord nNumBytesWrt Pointer lpNumBytesWritten Pointer lpOverlapped Returns Integer
|
||
250 | External_Function GetFileSizeEf "GetFileSize" kernel32.dll Handle hFile Pointer lpFileSizeHigh Returns Integer
|
||
251 | External_Function SetFilePointerEf "SetFilePointer" kernel32.dll Handle hFile Integer lDistToMove Pointer lpDistToMoveHigh DWord dwMoveMethod Returns Integer
|
||
252 | External_Function DeleteFileEf "DeleteFileA" Kernel32.Dll Pointer lpFileName Returns Integer
|
||
253 | External_Function CopyFileEf "CopyFileA" Kernel32.Dll Pointer lpExistingFileName Pointer lpNewFileName Boolean bFailIfExists Returns Integer
|
||
254 | External_Function FileTimeToSystemTimeEf "FileTimeToSystemTime" Kernel32.dll Pointer lpFiletime Pointer lpSystemtime Returns Integer
|
||
255 | External_Function FileTimeToLocalFileTimeEf "FileTimeToLocalFileTime" Kernel32.dll Pointer lpFileTime Pointer lpLocalFileTime Returns Integer
|
||
256 | External_Function GetDateFormatEf "GetDateFormatA" Kernel32.dll Integer iLocale DWord dwFlags Pointer lpDate Pointer lpFormat Pointer lpDateStr Integer icchDate Returns Integer
|
||
257 | External_Function GetTimeFormatEf "GetTimeFormatA" Kernel32.dll Integer iLocale DWord dwFlags Pointer lpTime Pointer lpFormat Pointer lpTimeSt Integer icchTime Returns Integer
|
||
258 | |||
259 | External_Function GetLastErrorEf "GetLastError" Kernel32.Dll Returns Integer
|
||
260 | |||
261 | External_Function LockFileEf "LockFile" Kernel32.dll Handle hFile DWord dwFileOffsetLow DWord dwFileOffsetHigh DWord nNumberOfBytesToLockLow DWord nNumberOfBytesToLockHigh Returns Integer
|
||
262 | External_Function UnLockFileEf "UnLockFile" Kernel32.dll Handle hFile DWord dwFileOffsetLow DWord dwFileOffsetHigh DWord nNumberOfBytesToUnLockLow DWord nNumberOfBytesToUnLockHigh Returns Integer
|
||
263 |