win32: pass utf8 function to dnd
All checks were successful
pyrite-dev/milsko/pipeline/head This commit looks good

This commit is contained in:
IoI_xD 2026-07-23 01:00:52 -07:00
commit f6c129b31c

View file

@ -19,7 +19,6 @@ static struct symtbl {
HRESULT(WINAPI* DwmSetWindowAttribute)(HWND hwnd, DWORD dwAttribute, LPCVOID pvAttribute, DWORD cbAttribute); HRESULT(WINAPI* DwmSetWindowAttribute)(HWND hwnd, DWORD dwAttribute, LPCVOID pvAttribute, DWORD cbAttribute);
UINT(WINAPI* DragQueryFileW)(HDROP hDrop, UINT iFile, LPWSTR lpszFile, UINT cch); UINT(WINAPI* DragQueryFileW)(HDROP hDrop, UINT iFile, LPWSTR lpszFile, UINT cch);
UINT(WINAPI* DragQueryFileA)(HDROP hDrop, UINT iFile, LPSTR lpszFile, UINT cch);
void (*DragAcceptFiles)(HWND hWnd, BOOL fAccept); void (*DragAcceptFiles)(HWND hWnd, BOOL fAccept);
void (*DragFinish)(HDROP hDrop); void (*DragFinish)(HDROP hDrop);
} wsymtbl; } wsymtbl;
@ -179,8 +178,13 @@ static LRESULT CALLBACK wndproc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp) {
count = wsymtbl.DragQueryFileW(hDrop, 0xFFFFFFFF, NULL, 0); count = wsymtbl.DragQueryFileW(hDrop, 0xFFFFFFFF, NULL, 0);
for(i = 0; i < count; i++) { for(i = 0; i < count; i++) {
wchar_t wpath[MAX_PATH];
char path[MAX_PATH]; char path[MAX_PATH];
wsymtbl.DragQueryFileA(hDrop, i, path, MAX_PATH); wsymtbl.DragQueryFileW(hDrop, i, wpath, MAX_PATH);
memset(path, 0, sizeof(path));
WideCharToMultiByte(CP_UTF8, 0, wpath, -1, path, sizeof(path) - 1, NULL, NULL);
MwLLDispatch(u->ll, drag_and_drop, path); MwLLDispatch(u->ll, drag_and_drop, path);
} }
wsymtbl.DragFinish(hDrop); wsymtbl.DragFinish(hDrop);
@ -1067,7 +1071,6 @@ static int MwLLGDICallInitImpl(void) {
} }
SHELL32_FUNC(DragQueryFileW); SHELL32_FUNC(DragQueryFileW);
SHELL32_FUNC(DragQueryFileA);
SHELL32_FUNC(DragAcceptFiles); SHELL32_FUNC(DragAcceptFiles);
SHELL32_FUNC(DragFinish); SHELL32_FUNC(DragFinish);