Fix minor issues with Windows bindings

This commit is contained in:
gingerBill
2026-04-02 12:52:17 +01:00
parent 40e03765a4
commit 1d8c44a98c
4 changed files with 7 additions and 8 deletions

View File

@@ -300,7 +300,7 @@ _iterate_gpus :: proc(it: ^GPU_Iterator, minimum_vram := i64(256 * 1024 * 1024))
gpu_key,
auto_cast it._index,
&buf_wstring[0],
&buf_len,
buf_len,
); status != i32(sys.ERROR_SUCCESS) {
return {}, it.index, false
}

View File

@@ -171,7 +171,7 @@ foreign advapi32 {
hKey: HKEY,
dwIndex: DWORD,
lpName: LPWSTR,
lpcchName: LPDWORD,
cchName: DWORD,
) -> LSTATUS ---
RegEnumKeyExW :: proc(

View File

@@ -465,7 +465,7 @@ get_computer_name_and_account_sid :: proc(username: string) -> (computer_name: s
return "", {}, false
}
cname_w := make([]u16, min(computer_name_size, 1), context.temp_allocator)
cname_w := make([]u16, computer_name_size context.temp_allocator)
res = LookupAccountNameW(
nil,
@@ -507,7 +507,7 @@ get_sid :: proc(username: string, sid: ^SID) -> (ok: bool) {
return false
}
cname_w := make([]u16, min(computer_name_size, 1), context.temp_allocator)
cname_w := make([]u16, computer_name_size, context.temp_allocator)
res = LookupAccountNameW(
nil,
@@ -707,7 +707,6 @@ run_as_user :: proc(username, password, application, commandline: string, pi: ^P
}
si := STARTUPINFOW{}
si.cb = size_of(STARTUPINFOW)
pi := pi
ok = bool(CreateProcessAsUserW(
user_token,
@@ -738,7 +737,7 @@ ensure_winsock_initialized :: proc "contextless" () {
@static gate := false
@static initted := false
if initted {
if intrinsics.atomic_load(&initted) {
return
}
@@ -752,5 +751,5 @@ ensure_winsock_initialized :: proc "contextless" () {
res := WSAStartup(version_requested, &unused_info)
assert_contextless(res == 0, "unable to initialized Winsock2")
initted = true
intrinsics.atomic_store(&initted, true)
}

View File

@@ -9,7 +9,7 @@ foreign version {
GetFileVersionInfoW :: proc(lptstrFilename: LPCWSTR, dwHandle: DWORD, dwLen: DWORD, lpData: LPVOID) -> BOOL ---
GetFileVersionInfoSizeExW :: proc(dwFlags: FILE_VER_GET_FLAGS, lpwstrFilename: LPCWSTR, lpdwHandle: LPDWORD) -> DWORD ---
GetFileVersionInfoExW :: proc(dwFlags: FILE_VER_GET_FLAGS, lpwstrFilename: LPCWSTR, dwHandle, dwLen: DWORD, lpData: LPVOID) -> DWORD ---
GetFileVersionInfoExW :: proc(dwFlags: FILE_VER_GET_FLAGS, lpwstrFilename: LPCWSTR, dwHandle, dwLen: DWORD, lpData: LPVOID) -> BOOL ---
VerLanguageNameW :: proc(wLang: DWORD, szLang: LPWSTR, cchLang: DWORD) -> DWORD ---
VerQueryValueW :: proc(pBlock: LPCVOID, lpSubBlock: LPCWSTR, lplpBuffer: ^LPVOID, puLen: PUINT) -> BOOL ---