📄 kernel.odl
字号:
#endif
[
#ifdef WIN32
usesgetlasterror,
entry("GetModuleFileNameA"),
#else
entry("GetModuleFileName"),
#endif
helpstring("Get full path name of a module from its handle"),
]
int WINAPI GetModuleFileName(
[in] HINSTANCE hInst, [out] LPSTR lpszFileName,
[in] int cbFileName);
/* Omitted
FARPROC WINAPI GetProcAddress(HINSTANCE, LPCSTR);
int WINAPI GetInstanceData(HINSTANCE, BYTE*, int);
HGLOBAL WINAPI GetCodeHandle(FARPROC);
void WINAPI GetCodeInfo(FARPROC lpProc, SEGINFO FAR* lpSegInfo);
FARPROC WINAPI MakeProcInstance(FARPROC, HINSTANCE);
void WINAPI FreeProcInstance(FARPROC);
LONG WINAPI SetSwapAreaSize(UINT);
void WINAPI SwapRecording(UINT);
void WINAPI ValidateCodeSegments(void);
UINT WINAPI GetNumTasks(void);
BOOL WINAPI IsTask(HTASK);
*/
[
usesgetlasterror,
entry("GetCurrentTask"),
helpstring("Get the current process (task)"),
]
HTASK WINAPI GetCurrentTask(void);
/* Omitted
void WINAPI Yield(void);
void WINAPI DirectedYield(HTASK);
*/
// ****** Global memory management ******
[
usesgetlasterror,
entry("GlobalAlloc"),
helpstring("Allocate global memory"),
]
HGLOBAL WINAPI GlobalAlloc([in] UINT fuAlloc, [in] DWORD cbAlloc);
[
usesgetlasterror,
entry("GlobalReAlloc"),
helpstring("Resize global memory block"),
]
HGLOBAL WINAPI GlobalReAlloc(
[in] HGLOBAL hglb, [in] DWORD cbNewSize, [in] UINT fuAlloc);
[
usesgetlasterror,
entry("GlobalFree"),
helpstring("Free global memory block"),
]
HGLOBAL WINAPI GlobalFree([in] HGLOBAL hglb);
[
usesgetlasterror,
entry("GlobalLock"),
helpstring("Locks global memory block and returns pointer to it"),
]
LPVOID WINAPI GlobalLock([in] HGLOBAL hglb);
[
usesgetlasterror,
entry("GlobalUnlock"),
helpstring("Unlocks global memory block"),
]
BOOL WINAPI GlobalUnlock([in] HGLOBAL hglb);
[
usesgetlasterror,
entry("GlobalSize"),
helpstring("Gets the size of global memory block"),
]
DWORD WINAPI GlobalSize([in] HGLOBAL hglb);
[
usesgetlasterror,
entry("GlobalFlags"),
helpstring("Gets attribute flags of global memory block"),
]
UINT WINAPI GlobalFlags([in] HGLOBAL hglb);
[
usesgetlasterror,
entry("GlobalCompact"),
helpstring("Rearranges memory to free requested memory, and returns largest available block size (pass 0 to get size without compacting)"),
]
DWORD WINAPI GlobalCompact([in] DWORD dwMinFree);
/* Omitted
DWORD WINAPI GlobalDosAlloc(DWORD);
UINT WINAPI GlobalDosFree(UINT);
DWORD WINAPI GlobalHandle(UINT);
void FAR* WINAPI GlobalWire(HGLOBAL);
BOOL WINAPI GlobalUnWire(HGLOBAL);
UINT WINAPI GlobalPageLock(HGLOBAL);
UINT WINAPI GlobalPageUnlock(HGLOBAL);
void WINAPI GlobalFix(HGLOBAL);
void WINAPI GlobalUnfix(HGLOBAL);
HGLOBAL WINAPI GlobalLRUNewest(HGLOBAL);
HGLOBAL WINAPI GlobalLRUOldest(HGLOBAL);
void WINAPI GlobalNotify(GNOTIFYPROC);
HGLOBAL WINAPI LockSegment(UINT);
void WINAPI UnlockSegment(UINT);
UINT WINAPI AllocSelector(UINT);
UINT WINAPI FreeSelector(UINT);
UINT WINAPI AllocDStoCSAlias(UINT);
UINT WINAPI PrestoChangoSelector(UINT sourceSel, UINT destSel);
DWORD WINAPI GetSelectorBase(UINT);
UINT WINAPI SetSelectorBase(UINT, DWORD);
DWORD WINAPI GetSelectorLimit(UINT);
UINT WINAPI SetSelectorLimit(UINT, DWORD);
void WINAPI LimitEmsPages(DWORD);
void WINAPI ValidateFreeSpaces(void);
// Win32 compatibility macros
//define DefineHandleTable(w) ((w),TRUE)
//define LimitEmsPages(dw)
//define SetSwapAreaSize(w) (w)
//define LockSegment(w) GlobalFix((HANDLE)(w))
//define UnlockSegment(w) GlobalUnfix((HANDLE)(w))
//define GetCurrentTime() GetTickCount()
//define GlobalLRUNewest( h ) (HANDLE)(h)
//define GlobalLRUOldest( h ) (HANDLE)(h)
//define GlobalDiscard( h ) GlobalReAlloc( (h), 0, GMEM_MOVEABLE )
//define FreeModule(hLibModule) FreeLibrary((hLibModule))
//define MakeProcInstance(lpProc,hInstance) (lpProc)
//define FreeProcInstance(lpProc) (lpProc)
//define Yield()
*/
/* All of local memory omitted
*/
/* Virtual memory not implemented
LPVOID WINAPI VirtualAlloc(LPVOID lpAddress, DWORD dwSize,
DWORD flAllocationType, DWORD flProtect);
BOOL WINAPI VirtualFree(LPVOID lpAddress, DWORD dwSize,
DWORD dwFreeType);
BOOL WINAPI VirtualLock(LPVOID lpAddress, DWORD dwSize);
BOOL WINAPI VirtualUnlock(LPVOID lpAddress, DWORD dwSize);
BOOL WINAPI VirtualProtect(LPVOID lpAddress, DWORD dwSize,
DWORD flNewProtect, PDWORD lpflOldProtect);
DWORD WINAPI VirtualQuery(LPCVOID lpAddress,
PMEMORY_BASIC_INFORMATION lpBuffer,
DWORD dwLength);
BOOL WINAPI VirtualProtectEx(HANDLE hProcess, LPVOID lpAddress,
DWORD dwSize, DWORD flNewProtect,
PDWORD lpflOldProtect);
DWORD WINAPI VirtualQueryEx(HANDLE hProcess, LPCVOID lpAddress,
PMEMORY_BASIC_INFORMATION lpBuffer,
DWORD dwLength);
*/
/* Heap memory not implemented
HANDLE WINAPI HeapCreate(DWORD flOptions, DWORD dwInitialSize,
DWORD dwMaximumSize);
BOOL WINAPI HeapDestroy(HANDLE hHeap);
LPVOID WINAPI HeapAlloc(HANDLE hHeap, DWORD dwFlags, DWORD dwBytes);
LPVOID WINAPI HeapReAlloc(HANDLE hHeap, DWORD dwFlags,
LPVOID lpMem, DWORD dwBytes);
BOOL WINAPI HeapFree(HANDLE hHeap, DWORD dwFlags, LPVOID lpMem);
DWORD WINAPI HeapSize(HANDLE hHeap, DWORD dwFlags, LPCVOID lpMem);
BOOL WINAPI HeapValidate(HANDLE hHeap, DWORD dwFlags, LPCVOID lpMem);
HANDLE WINAPI GetProcessHeap( VOID );
*/
// ****** File I/O **********
/* Omit OpenFile
typedef struct tagOFSTRUCT
{
BYTE cBytes;
BYTE fFixedDisk;
UINT nErrCode;
BYTE reserved[4];
char szPathName[128];
} OFSTRUCT;
typedef OFSTRUCT* POFSTRUCT;
typedef OFSTRUCT NEAR* NPOFSTRUCT;
typedef OFSTRUCT FAR* LPOFSTRUCT;
HFILE WINAPI OpenFile(LPCSTR, OFSTRUCT FAR*, UINT);
*/
// OpenFile() Flags
const DWORD OF_READ = 0x0000;
const DWORD OF_WRITE = 0x0001;
const DWORD OF_READWRITE = 0x0002;
const DWORD OF_SHARE_COMPAT = 0x0000;
const DWORD OF_SHARE_EXCLUSIVE = 0x0010;
const DWORD OF_SHARE_DENY_WRITE = 0x0020;
const DWORD OF_SHARE_DENY_READ = 0x0030;
const DWORD OF_SHARE_DENY_NONE = 0x0040;
const DWORD OF_PARSE = 0x0100;
const DWORD OF_DELETE = 0x0200;
const DWORD OF_VERIFY = 0x0400;
const DWORD OF_SEARCH = 0x0400;
const DWORD OF_CANCEL = 0x0800;
const DWORD OF_CREATE = 0x1000;
const DWORD OF_PROMPT = 0x2000;
const DWORD OF_EXIST = 0x4000;
const DWORD OF_REOPEN = 0x8000;
[
usesgetlasterror,
entry("_lopen"),
helpstring("Opens a file"),
]
HFILE WINAPI lopen([in] LPCSTR lpszFileName, [in] int fnOpenMode);
[
usesgetlasterror,
entry("_lcreat"),
helpstring("Creates a file"),
]
HFILE WINAPI lcreat([in] LPCSTR lpszFileName, [in] int fnOpenMode);
[
usesgetlasterror,
entry("_lclose"),
helpstring("Closes a file handle"),
]
HFILE WINAPI lclose([in] HFILE hf);
[
usesgetlasterror,
entry("_lclose"),
helpstring("Sets the seek position (see SEEK_SET)"),
]
LONG WINAPI llseek([in] HFILE hf, [in] LONG lOffset, [in] int nOrigin);
[
usesgetlasterror,
entry("_lread"),
helpstring("Reads a buffer from a file"),
]
UINT WINAPI lread([in] HFILE hf, [out] LPSTR lpBuffer, [in] UINT cbBuffer);
[
usesgetlasterror,
entry("_lwrite"),
helpstring("Writes a buffer to a file"),
]
UINT WINAPI lwrite([in] HFILE hf, [out] LPSTR lpBuffer, [in] UINT cbBuffer);
/* Omitted
long WINAPI _hread([in] HFILE, void _huge*, long);
long WINAPI _hwrite(HFILE, const void _huge*, long);
*/
/* Omitted (see Win32)
// GetTempFileName() Flags
//define TF_FORCEDRIVE (BYTE)0x80
int WINAPI GetTempFileName(BYTE, LPCSTR, UINT, LPSTR);
BYTE WINAPI GetTempDrive(char);
UINT WINAPI GetDriveType(int);
UINT WINAPI SetHandleCount(UINT);
*/
[
usesgetlasterror,
entry("CreateFileA"),
helpstring("Creates or opens a file, pipe, communications resource, disk device, console, or directory"),
]
HANDLE WINAPI CreateFile([in] LPCSTR lpFileName,
[in] DWORD dwDesiredAccess,
[in] DWORD dwShareMode,
[in] LONG lpSecurityAttributes,
[in] DWORD dwCreationDisposition,
[in] DWORD dwFlagsAndAttributes,
[in] HANDLE hTemplateFile);
[
usesgetlasterror,
entry("SetFileAttributesA"),
helpstring("Sets file attribute bitflags"),
]
BOOL WINAPI SetFileAttributes([in] LPCSTR lpFileName,
[in] DWORD dwFileAttributes);
[
usesgetlasterror,
entry("GetFileAttributesA"),
helpstring("Gets file attribute bitflags"),
]
DWORD WINAPI GetFileAttributes([in] LPCSTR lpFileName);
/* Most File and handle functions not implemented
DWORD WINAPI GetCompressedFileSizeA(LPCSTR lpFileName,
LPDWORD lpFileSizeHigh);
BOOL WINAPI DeleteFileA(LPCSTR lpFileName);
UINT WINAPI SetHandleCount(UINT uNumber);
BOOL WINAPI LockFile(HANDLE hFile, DWORD dwFileOffsetLow,
DWORD dwFileOffsetHigh,
DWORD nNumberOfBytesToLockLow,
DWORD nNumberOfBytesToLockHigh);
BOOL WINAPI UnlockFile(HANDLE hFile,
DWORD dwFileOffsetLow,
DWORD dwFileOffsetHigh,
DWORD nNumberOfBytesToUnlockLow,
DWORD nNumberOfBytesToUnlockHigh);
BOOL WINAPI LockFileEx(HANDLE hFile, DWORD dwFlags, DWORD dwReserved,
DWORD nNumberOfBytesToLockLow,
DWORD nNumberOfBytesToLockHigh,
LPOVERLAPPED lpOverlapped);
const DWORD LOCKFILE_FAIL_IMMEDIATELY = 0x00000001;
const DWORD LOCKFILE_EXCLUSIVE_LOCK = 0x00000002;
BOOL WINAPI UnlockFileEx(HANDLE hFile, DWORD dwReserved,
DWORD nNumberOfBytesToUnlockLow,
DWORD nNumberOfBytesToUnlockHigh,
LPOVERLAPPED lpOverlapped);
typedef struct _BY_HANDLE_FILE_INFORMATION {
DWORD dwFileAttributes;
FILETIME ftCreationTime;
FILETIME ftLastAccessTime;
FILETIME ftLastWriteTime;
DWORD dwVolumeSerialNumber;
DWORD nFileSizeHigh;
DWORD nFileSizeLow;
DWORD nNumberOfLinks;
DWORD nFileIndexHigh;
DWORD nFileIndexLow;
} BY_HANDLE_FILE_INFORMATION, *PBY_HANDLE_FILE_INFORMATION, *LPBY_HANDLE_FILE_INFORMATION;
BOOL WINAPI GetFileInformationByHandle(HANDLE hFile,
LPBY_HANDLE_FILE_INFORMATION lpFileInformation);
DWORD WINAPI GetFileType(HANDLE hFile);
DWORD WINAPI GetFileSize(HANDLE hFile, LPDWORD lpFileSizeHigh);
BOOL WINAPI CopyFileA(LPCSTR lpExistingFileName,
LPCSTR lpNewFileName, BOOL bFailIfExists);
BOOL WINAPI MoveFileA(LPCSTR lpExistingFileName, LPCSTR lpNewFileName);
BOOL WINAPI MoveFileExA(LPCSTR lpExistingFileName,
LPCSTR lpNewFileName, DWORD dwFlags);
const DWORD MOVEFILE_REPLACE_EXISTING = 0x00000001;
const DWORD MOVEFILE_COPY_ALLOWED = 0x00000002;
const DWORD MOVEFILE_DELAY_UNTIL_REBOOT = 0x00000004;
HANDLE WINAPI GetStdHandle(DWORD nStdHandle);
BOOL WINAPI SetStdHandle(DWORD nStdHandle, HANDLE hHandle);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -