mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Added some Win32 declarations.
This commit is contained in:
@@ -21,7 +21,7 @@ fn bool native_file_or_dir_exists(String path)
|
||||
{
|
||||
@pool()
|
||||
{
|
||||
return files::win32_PathFileExistsW(path.to_temp_utf16()) ?? false;
|
||||
return (bool)files::win32_PathFileExistsW(path.to_temp_utf16()) ?? false;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -24,10 +24,12 @@ struct Win32_FILE_ATTRIBUTE_DATA
|
||||
Win32_DWORD nFileSizeLow;
|
||||
}
|
||||
|
||||
extern fn bool win32_GetFileAttributesExW(Win32_LPCWSTR, Win32_GET_FILEEX_INFO_LEVELS, Win32_LPVOID) @extern("GetFileAttributesExW");
|
||||
extern fn bool win32_PathFileExistsW(Win32_LPCWSTR) @extern("PathFileExistsW");
|
||||
extern fn Win32_BOOL win32_CloseHandle(Win32_HANDLE) @extern("CloseHandle");
|
||||
extern fn Win32_BOOL win32_CreatePipe(Win32_PHANDLE hReadPipe, Win32_PHANDLE hWritePipe, Win32_LPSECURITY_ATTRIBUTES lpPipeAttributes, Win32_DWORD nSize) @extern("CreatePipe");
|
||||
extern fn Win32_BOOL win32_GetFileAttributesExW(Win32_LPCWSTR, Win32_GET_FILEEX_INFO_LEVELS, Win32_LPVOID) @extern("GetFileAttributesExW");
|
||||
extern fn Win32_BOOL win32_PathFileExistsW(Win32_LPCWSTR) @extern("PathFileExistsW");
|
||||
extern fn Win32_DWORD win32_GetTempPathW(Win32_DWORD nBufferLength, Win32_LPWSTR lpBuffer) @extern("GetTempPathW");
|
||||
extern fn bool win32_SetCurrentDirectoryW(Win32_LPCTSTR buffer) @extern("SetCurrentDirectoryW");
|
||||
extern fn Win32_BOOL win32_SetCurrentDirectoryW(Win32_LPCTSTR buffer) @extern("SetCurrentDirectoryW");
|
||||
|
||||
/*
|
||||
extern ulong _win32_GetCurrentDirectoryW(ulong, Char16* buffer) @extern("GetCurrentDirectoryW");
|
||||
|
||||
18
lib/std/os/win32/process.c3
Normal file
18
lib/std/os/win32/process.c3
Normal file
@@ -0,0 +1,18 @@
|
||||
module std::os::win32::process;
|
||||
|
||||
$if (env::os_is_win32()):
|
||||
|
||||
extern fn bool win32_CreateProcessW(
|
||||
Win32_LPCWSTR lpApplicationName,
|
||||
Win32_LPWSTR lpCommandLine,
|
||||
Win32_LPSECURITY_ATTRIBUTES lpProcessAttributes,
|
||||
Win32_LPSECURITY_ATTRIBUTES lpThreadAttributes,
|
||||
Win32_BOOL bInheritHandles,
|
||||
Win32_DWORD dwCreationFlags,
|
||||
Win32_LPVOID lpEnvironment,
|
||||
Win32_LPCWSTR lpCurrentDirectory,
|
||||
Win32_LPSTARTUPINFOW lpStartupInfo,
|
||||
Win32_LPPROCESS_INFORMATION lpProcessInformation
|
||||
);
|
||||
|
||||
$endif;
|
||||
@@ -183,4 +183,60 @@ union Win32_LARGE_INTEGER
|
||||
Win32_LONG highPart;
|
||||
}
|
||||
ulong quadPart;
|
||||
}
|
||||
}
|
||||
|
||||
typedef Win32_CRITICAL_SECTION = distinct ulong[5];
|
||||
|
||||
struct Win32_SECURITY_ATTRIBUTES
|
||||
{
|
||||
Win32_DWORD nLength;
|
||||
Win32_LPVOID lpSecurityDescriptor;
|
||||
Win32_BOOL bInheritHandle;
|
||||
}
|
||||
|
||||
typedef Win32_LPSECURITY_ATTRIBUTES = Win32_SECURITY_ATTRIBUTES*;
|
||||
typedef Win32_PSECURITY_ATTRIBUTES = Win32_SECURITY_ATTRIBUTES*;
|
||||
|
||||
struct Win32_STARTUPINFOW
|
||||
{
|
||||
Win32_DWORD cb;
|
||||
Win32_LPWSTR lpReserved;
|
||||
Win32_LPWSTR lpDesktop;
|
||||
Win32_LPWSTR lpTitle;
|
||||
Win32_DWORD dwX;
|
||||
Win32_DWORD dwY;
|
||||
Win32_DWORD dwXSize;
|
||||
Win32_DWORD dwYSize;
|
||||
Win32_DWORD dwXCountChars;
|
||||
Win32_DWORD dwYCountChars;
|
||||
Win32_DWORD dwFillAttribute;
|
||||
Win32_DWORD dwFlags;
|
||||
Win32_WORD wShowWindow;
|
||||
Win32_WORD cbReserved2;
|
||||
Win32_LPBYTE lpReserved2;
|
||||
Win32_HANDLE hStdInput;
|
||||
Win32_HANDLE hStdOutput;
|
||||
Win32_HANDLE hStdError;
|
||||
}
|
||||
|
||||
typedef Win32_LPSTARTUPINFOW = Win32_STARTUPINFOW*;
|
||||
|
||||
struct Win32_STARTUPINFOEXW
|
||||
{
|
||||
inline Win32_STARTUPINFOW win32_StartupInfo;
|
||||
Win32_LPPROC_THREAD_ATTRIBUTE_LIST lpAttributeList;
|
||||
}
|
||||
|
||||
typedef Win32_LPPROC_THREAD_ATTRIBUTE_LIST = void*;
|
||||
typedef Win32_LPSTARTUPINFOEXW = Win32_STARTUPINFOEXW*;
|
||||
|
||||
struct Win32_PROCESS_INFORMATION
|
||||
{
|
||||
Win32_HANDLE hProcess;
|
||||
Win32_HANDLE hThread;
|
||||
Win32_DWORD dwProcessId;
|
||||
Win32_DWORD dwThreadId;
|
||||
}
|
||||
|
||||
typedef Win32_PPROCESS_INFORMATION = Win32_PROCESS_INFORMATION*;
|
||||
typedef Win32_LPPROCESS_INFORMATION = Win32_PROCESS_INFORMATION*;
|
||||
|
||||
@@ -3,8 +3,6 @@ module std::thread::os;
|
||||
$if (thread::THREAD_MODEL == ThreadModel.WIN32):
|
||||
|
||||
typedef NativeThread = Win32_HANDLE;
|
||||
typedef Win32_CRITICAL_SECTION = distinct ulong[5];
|
||||
typedef Win32_HANDLE = distinct ulong;
|
||||
|
||||
struct NativeMutex
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user