Remove A calls in favour of W calls

This commit is contained in:
gingerBill
2022-05-12 14:21:25 +01:00
parent d1fc9d3073
commit 0c45a46aab
6 changed files with 33 additions and 123 deletions
+10 -37
View File
@@ -56,49 +56,22 @@ foreign bthprops {
/* /*
Version Version
*/ */
@(link_name="BluetoothIsVersionAvailable") bluetooth_is_version_available :: proc( BluetoothIsVersionAvailable :: proc(major: u8, minor: u8) -> BOOL ---
major: u8, minor: u8,
) -> BOOL ---
/* /*
Radio enumeration Radio enumeration
*/ */
@(link_name="BluetoothFindFirstRadio") bluetooth_find_first_radio :: proc( BluetoothFindFirstRadio :: proc(find_radio_params: ^BLUETOOTH_FIND_RADIO_PARAMS, radio: ^HANDLE) -> HBLUETOOTH_RADIO_FIND ---
find_radio_params: ^BLUETOOTH_FIND_RADIO_PARAMS, radio: ^HANDLE, BluetoothFindNextRadio :: proc(handle: HBLUETOOTH_RADIO_FIND, radio: ^HANDLE) -> BOOL ---
) -> HBLUETOOTH_RADIO_FIND --- BluetoothFindRadioClose :: proc(handle: HBLUETOOTH_RADIO_FIND) -> BOOL ---
BluetoothGetRadioInfo :: proc(radio: HANDLE, radio_info: ^BLUETOOTH_RADIO_INFO) -> DWORD ---
@(link_name="BluetoothFindNextRadio") bluetooth_find_next_radio :: proc(
handle: HBLUETOOTH_RADIO_FIND, radio: ^HANDLE,
) -> BOOL ---
@(link_name="BluetoothFindRadioClose") bluetooth_find_radio_close :: proc(
handle: HBLUETOOTH_RADIO_FIND,
) -> BOOL ---
@(link_name="BluetoothGetRadioInfo") bluetooth_get_radio_info :: proc(
radio: HANDLE, radio_info: ^BLUETOOTH_RADIO_INFO,
) -> DWORD ---
/* /*
Device enumeration Device enumeration
*/ */
@(link_name="BluetoothFindFirstDevice") bluetooth_find_first_device :: proc( BluetoothFindFirstDevice :: proc(search_params: ^BLUETOOTH_DEVICE_SEARCH_PARAMS, device_info: ^BLUETOOTH_DEVICE_INFO) -> HBLUETOOTH_DEVICE_FIND ---
search_params: ^BLUETOOTH_DEVICE_SEARCH_PARAMS, device_info: ^BLUETOOTH_DEVICE_INFO, BluetoothFindNextDevice :: proc(handle: HBLUETOOTH_DEVICE_FIND, device_info: ^BLUETOOTH_DEVICE_INFO) -> BOOL ---
) -> HBLUETOOTH_DEVICE_FIND --- BluetoothFindDeviceClose :: proc(handle: HBLUETOOTH_DEVICE_FIND) -> BOOL ---
BluetoothGetDeviceInfo :: proc(radio: HANDLE, device_info: ^BLUETOOTH_DEVICE_INFO) -> DWORD ---
@(link_name="BluetoothFindNextDevice") bluetooth_find_next_device :: proc( BluetoothDisplayDeviceProperties :: proc(hwnd_parent: HWND, device_info: ^BLUETOOTH_DEVICE_INFO) -> BOOL ---
handle: HBLUETOOTH_DEVICE_FIND, device_info: ^BLUETOOTH_DEVICE_INFO,
) -> BOOL ---
@(link_name="BluetoothFindDeviceClose") bluetooth_find_device_close :: proc(
handle: HBLUETOOTH_DEVICE_FIND,
) -> BOOL ---
@(link_name="BluetoothGetDeviceInfo") bluetooth_get_device_info :: proc(
radio: HANDLE, device_info: ^BLUETOOTH_DEVICE_INFO,
) -> DWORD ---
@(link_name="BluetoothDisplayDeviceProperties") bluetooth_display_device_properties :: proc(
hwnd_parent: HWND, device_info: ^BLUETOOTH_DEVICE_INFO,
) -> BOOL ---
} }
+2 -1
View File
@@ -5,7 +5,8 @@ foreign import kernel32 "system:Kernel32.lib"
@(default_calling_convention="stdcall") @(default_calling_convention="stdcall")
foreign kernel32 { foreign kernel32 {
OutputDebugStringA :: proc(lpOutputString: LPCSTR) --- OutputDebugStringA :: proc(lpOutputString: LPCSTR) --- // The only A thing that is allowed
OutputDebugStringW :: proc(lpOutputString: LPCSTR) ---
ReadConsoleW :: proc(hConsoleInput: HANDLE, ReadConsoleW :: proc(hConsoleInput: HANDLE,
lpBuffer: LPVOID, lpBuffer: LPVOID,
+2 -2
View File
@@ -5,7 +5,7 @@ foreign import Synchronization "system:Synchronization.lib"
@(default_calling_convention="stdcall") @(default_calling_convention="stdcall")
foreign Synchronization { foreign Synchronization {
WaitOnAddress :: proc(Address: PVOID, CompareAddress: PVOID, AddressSize: SIZE_T, dwMilliseconds: DWORD) -> BOOL --- WaitOnAddress :: proc(Address: PVOID, CompareAddress: PVOID, AddressSize: SIZE_T, dwMilliseconds: DWORD) -> BOOL ---
WakeByAddressSingle :: proc(Address: PVOID) --- WakeByAddressSingle :: proc(Address: PVOID) ---
WakeByAddressAll :: proc(Address: PVOID) --- WakeByAddressAll :: proc(Address: PVOID) ---
} }
+2 -66
View File
@@ -5,43 +5,20 @@ foreign import user32 "system:User32.lib"
@(default_calling_convention="stdcall") @(default_calling_convention="stdcall")
foreign user32 { foreign user32 {
GetClassInfoA :: proc(hInstance: HINSTANCE, lpClassNAme: LPCSTR, lpWndClass: ^WNDCLASSA) -> BOOL ---
GetClassInfoW :: proc(hInstance: HINSTANCE, lpClassNAme: LPCWSTR, lpWndClass: ^WNDCLASSW) -> BOOL --- GetClassInfoW :: proc(hInstance: HINSTANCE, lpClassNAme: LPCWSTR, lpWndClass: ^WNDCLASSW) -> BOOL ---
GetClassInfoExA :: proc(hInsatnce: HINSTANCE, lpszClass: LPCSTR, lpwcx: ^WNDCLASSEXA) -> BOOL ---
GetClassInfoExW :: proc(hInsatnce: HINSTANCE, lpszClass: LPCWSTR, lpwcx: ^WNDCLASSEXW) -> BOOL --- GetClassInfoExW :: proc(hInsatnce: HINSTANCE, lpszClass: LPCWSTR, lpwcx: ^WNDCLASSEXW) -> BOOL ---
GetClassLongA :: proc(hWnd: HWND, nIndex: c_int) -> DWORD ---
GetClassLongW :: proc(hWnd: HWND, nIndex: c_int) -> DWORD --- GetClassLongW :: proc(hWnd: HWND, nIndex: c_int) -> DWORD ---
SetClassLongA :: proc(hWnd: HWND, nIndex: c_int, dwNewLong: LONG) -> DWORD ---
SetClassLongW :: proc(hWnd: HWND, nIndex: c_int, dwNewLong: LONG) -> DWORD --- SetClassLongW :: proc(hWnd: HWND, nIndex: c_int, dwNewLong: LONG) -> DWORD ---
GetWindowLongA :: proc(hWnd: HWND, nIndex: c_int) -> LONG ---
GetWindowLongW :: proc(hWnd: HWND, nIndex: c_int) -> LONG --- GetWindowLongW :: proc(hWnd: HWND, nIndex: c_int) -> LONG ---
SetWindowLongA :: proc(hWnd: HWND, nIndex: c_int, dwNewLong: LONG) -> LONG ---
SetWindowLongW :: proc(hWnd: HWND, nIndex: c_int, dwNewLong: LONG) -> LONG --- SetWindowLongW :: proc(hWnd: HWND, nIndex: c_int, dwNewLong: LONG) -> LONG ---
GetClassNameA :: proc(hWnd: HWND, lpClassName: LPSTR, nMaxCount: c_int) -> c_int ---
GetClassNameW :: proc(hWnd: HWND, lpClassName: LPWSTR, nMaxCount: c_int) -> c_int --- GetClassNameW :: proc(hWnd: HWND, lpClassName: LPWSTR, nMaxCount: c_int) -> c_int ---
RegisterClassA :: proc(lpWndClass: ^WNDCLASSA) -> ATOM ---
RegisterClassW :: proc(lpWndClass: ^WNDCLASSW) -> ATOM --- RegisterClassW :: proc(lpWndClass: ^WNDCLASSW) -> ATOM ---
RegisterClassExA :: proc(^WNDCLASSEXA) -> ATOM ---
RegisterClassExW :: proc(^WNDCLASSEXW) -> ATOM --- RegisterClassExW :: proc(^WNDCLASSEXW) -> ATOM ---
CreateWindowExA :: proc(
dwExStyle: DWORD,
lpClassName: LPCSTR,
lpWindowName: LPCSTR,
dwStyle: DWORD,
X: c_int,
Y: c_int,
nWidth: c_int,
nHeight: c_int,
hWndParent: HWND,
hMenu: HMENU,
hInstance: HINSTANCE,
lpParam: LPVOID,
) -> HWND ---
CreateWindowExW :: proc( CreateWindowExW :: proc(
dwExStyle: DWORD, dwExStyle: DWORD,
lpClassName: LPCWSTR, lpClassName: LPCWSTR,
@@ -67,11 +44,9 @@ foreign user32 {
SetActiveWindow :: proc(hWnd: HWND) -> HWND --- SetActiveWindow :: proc(hWnd: HWND) -> HWND ---
GetActiveWindow :: proc() -> HWND --- GetActiveWindow :: proc() -> HWND ---
GetMessageA :: proc(lpMsg: ^MSG, hWnd: HWND, wMsgFilterMin: UINT, wMsgFilterMax: UINT) -> BOOL ---
GetMessageW :: proc(lpMsg: ^MSG, hWnd: HWND, wMsgFilterMin: UINT, wMsgFilterMax: UINT) -> BOOL --- GetMessageW :: proc(lpMsg: ^MSG, hWnd: HWND, wMsgFilterMin: UINT, wMsgFilterMax: UINT) -> BOOL ---
TranslateMessage :: proc(lpMsg: ^MSG) -> BOOL --- TranslateMessage :: proc(lpMsg: ^MSG) -> BOOL ---
DispatchMessageA :: proc(lpMsg: ^MSG) -> LRESULT ---
DispatchMessageW :: proc(lpMsg: ^MSG) -> LRESULT --- DispatchMessageW :: proc(lpMsg: ^MSG) -> LRESULT ---
PeekMessageA :: proc(lpMsg: ^MSG, hWnd: HWND, wMsgFilterMin: UINT, wMsgFilterMax: UINT, wRemoveMsg: UINT) -> BOOL --- PeekMessageA :: proc(lpMsg: ^MSG, hWnd: HWND, wMsgFilterMin: UINT, wMsgFilterMax: UINT, wRemoveMsg: UINT) -> BOOL ---
@@ -141,10 +116,8 @@ foreign user32 {
GetKeyState :: proc(nVirtKey: c_int) -> SHORT --- GetKeyState :: proc(nVirtKey: c_int) -> SHORT ---
GetAsyncKeyState :: proc(vKey: c_int) -> SHORT --- GetAsyncKeyState :: proc(vKey: c_int) -> SHORT ---
MapVirtualKeyA :: proc(uCode: UINT, uMapType: UINT) -> UINT ---
MapVirtualKeyW :: proc(uCode: UINT, uMapType: UINT) -> UINT --- MapVirtualKeyW :: proc(uCode: UINT, uMapType: UINT) -> UINT ---
SetWindowsHookExA :: proc(idHook: c_int, lpfn: HOOKPROC, hmod: HINSTANCE, dwThreadId: DWORD) -> HHOOK ---
SetWindowsHookExW :: proc(idHook: c_int, lpfn: HOOKPROC, hmod: HINSTANCE, dwThreadId: DWORD) -> HHOOK --- SetWindowsHookExW :: proc(idHook: c_int, lpfn: HOOKPROC, hmod: HINSTANCE, dwThreadId: DWORD) -> HHOOK ---
UnhookWindowsHookEx :: proc(hhk: HHOOK) -> BOOL --- UnhookWindowsHookEx :: proc(hhk: HHOOK) -> BOOL ---
CallNextHookEx :: proc(hhk: HHOOK, nCode: c_int, wParam: WPARAM, lParam: LPARAM) -> LRESULT --- CallNextHookEx :: proc(hhk: HHOOK, nCode: c_int, wParam: WPARAM, lParam: LPARAM) -> LRESULT ---
@@ -152,9 +125,9 @@ foreign user32 {
SetTimer :: proc(hWnd: HWND, nIDEvent: UINT_PTR, uElapse: UINT, lpTimerFunc: TIMERPROC) -> UINT_PTR --- SetTimer :: proc(hWnd: HWND, nIDEvent: UINT_PTR, uElapse: UINT, lpTimerFunc: TIMERPROC) -> UINT_PTR ---
KillTimer :: proc(hWnd: HWND, uIDEvent: UINT_PTR) -> BOOL --- KillTimer :: proc(hWnd: HWND, uIDEvent: UINT_PTR) -> BOOL ---
MessageBoxA :: proc(hWnd: HWND, lpText: LPCSTR, lpCaption: LPCSTR, uType: UINT) -> c_int --- // MessageBoxA :: proc(hWnd: HWND, lpText: LPCSTR, lpCaption: LPCSTR, uType: UINT) -> c_int ---
MessageBoxW :: proc(hWnd: HWND, lpText: LPCWSTR, lpCaption: LPCWSTR, uType: UINT) -> c_int --- MessageBoxW :: proc(hWnd: HWND, lpText: LPCWSTR, lpCaption: LPCWSTR, uType: UINT) -> c_int ---
MessageBoxExA :: proc(hWnd: HWND, lpText: LPCSTR, lpCaption: LPCSTR, uType: UINT, wLanguageId: WORD) -> c_int --- // MessageBoxExA :: proc(hWnd: HWND, lpText: LPCSTR, lpCaption: LPCSTR, uType: UINT, wLanguageId: WORD) -> c_int ---
MessageBoxExW :: proc(hWnd: HWND, lpText: LPCWSTR, lpCaption: LPCWSTR, uType: UINT, wLanguageId: WORD) -> c_int --- MessageBoxExW :: proc(hWnd: HWND, lpText: LPCWSTR, lpCaption: LPCWSTR, uType: UINT, wLanguageId: WORD) -> c_int ---
ClipCursor :: proc(lpRect: LPRECT) -> BOOL --- ClipCursor :: proc(lpRect: LPRECT) -> BOOL ---
@@ -163,35 +136,6 @@ foreign user32 {
SetCursor :: proc(hCursor: HCURSOR) -> HCURSOR --- SetCursor :: proc(hCursor: HCURSOR) -> HCURSOR ---
} }
CreateWindowA :: #force_inline proc "stdcall" (
lpClassName: LPCSTR,
lpWindowName: LPCSTR,
dwStyle: DWORD,
X: c_int,
Y: c_int,
nWidth: c_int,
nHeight: c_int,
hWndParent: HWND,
hMenu: HMENU,
hInstance: HINSTANCE,
lpParam: LPVOID,
) -> HWND {
return CreateWindowExA(
0,
lpClassName,
lpWindowName,
dwStyle,
X,
Y,
nWidth,
nHeight,
hWndParent,
hMenu,
hInstance,
lpParam,
)
}
CreateWindowW :: #force_inline proc "stdcall" ( CreateWindowW :: #force_inline proc "stdcall" (
lpClassName: LPCTSTR, lpClassName: LPCTSTR,
lpWindowName: LPCTSTR, lpWindowName: LPCTSTR,
@@ -224,25 +168,17 @@ CreateWindowW :: #force_inline proc "stdcall" (
when ODIN_ARCH == .amd64 { when ODIN_ARCH == .amd64 {
@(default_calling_convention="stdcall") @(default_calling_convention="stdcall")
foreign user32 { foreign user32 {
GetClassLongPtrA :: proc(hWnd: HWND, nIndex: c_int) -> ULONG_PTR ---
GetClassLongPtrW :: proc(hWnd: HWND, nIndex: c_int) -> ULONG_PTR --- GetClassLongPtrW :: proc(hWnd: HWND, nIndex: c_int) -> ULONG_PTR ---
SetClassLongPtrA :: proc(hWnd: HWND, nIndex: c_int, dwNewLong: LONG_PTR) -> ULONG_PTR ---
SetClassLongPtrW :: proc(hWnd: HWND, nIndex: c_int, dwNewLong: LONG_PTR) -> ULONG_PTR --- SetClassLongPtrW :: proc(hWnd: HWND, nIndex: c_int, dwNewLong: LONG_PTR) -> ULONG_PTR ---
GetWindowLongPtrA :: proc(hWnd: HWND, nIndex: c_int) -> LONG_PTR ---
GetWindowLongPtrW :: proc(hWnd: HWND, nIndex: c_int) -> LONG_PTR --- GetWindowLongPtrW :: proc(hWnd: HWND, nIndex: c_int) -> LONG_PTR ---
SetWindowLongPtrA :: proc(hWnd: HWND, nIndex: c_int, dwNewLong: LONG_PTR) -> LONG_PTR ---
SetWindowLongPtrW :: proc(hWnd: HWND, nIndex: c_int, dwNewLong: LONG_PTR) -> LONG_PTR --- SetWindowLongPtrW :: proc(hWnd: HWND, nIndex: c_int, dwNewLong: LONG_PTR) -> LONG_PTR ---
} }
} else when ODIN_ARCH == .i386 { } else when ODIN_ARCH == .i386 {
GetClassLongPtrA :: GetClassLongA
GetClassLongPtrW :: GetClassLongW GetClassLongPtrW :: GetClassLongW
SetClassLongPtrA :: SetClassLongA
SetClassLongPtrW :: SetClassLongW SetClassLongPtrW :: SetClassLongW
GetWindowLongPtrA :: GetWindowLongA
GetWindowLongPtrW :: GetWindowLongW GetWindowLongPtrW :: GetWindowLongW
SetWindowLongPtrA :: GetWindowLongA
SetWindowLongPtrW :: GetWindowLongW SetWindowLongPtrW :: GetWindowLongW
} }
+16 -16
View File
@@ -451,20 +451,20 @@ run_as_user :: proc(username, password, application, commandline: string, pi: ^P
nil, // lpProcessAttributes, nil, // lpProcessAttributes,
nil, // lpThreadAttributes, nil, // lpThreadAttributes,
false, // bInheritHandles, false, // bInheritHandles,
0, // creation flags 0, // creation flags
nil, // environment, nil, // environment,
nil, // current directory: inherit from parent if nil nil, // current directory: inherit from parent if nil
&si, &si,
pi, pi,
)) ))
if ok { if ok {
if wait { if wait {
WaitForSingleObject(pi.hProcess, INFINITE) WaitForSingleObject(pi.hProcess, INFINITE)
CloseHandle(pi.hProcess) CloseHandle(pi.hProcess)
CloseHandle(pi.hThread) CloseHandle(pi.hThread)
} }
return true return true
} else { } else {
return false return false
} }
} }
+1 -1
View File
@@ -6,5 +6,5 @@ foreign import winmm "system:Winmm.lib"
@(default_calling_convention="stdcall") @(default_calling_convention="stdcall")
foreign winmm { foreign winmm {
timeBeginPeriod :: proc(uPeriod: UINT) -> MMRESULT --- timeBeginPeriod :: proc(uPeriod: UINT) -> MMRESULT ---
timeEndPeriod :: proc(uPeriod: UINT) -> MMRESULT --- timeEndPeriod :: proc(uPeriod: UINT) -> MMRESULT ---
} }