We can now at least compile the whole VM and main plugins with -DUNICODE You can view, comment on, or merge this pull request online at:
https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/332
-- Commit Summary --
* Handle both an ASCII (UTF8) and a WIDE (UTF16) version of image/vm name/path * DropPlugin: modernize OpenFile/_lwrite/_lclose API * Drop plugin: let tempPathName be Wide * Fix 2 potential buffer overrun in sqWin32Service.c * Setting fp flags _MCW_PC and _MCW_IC is not supported on ARM nor X64 * The pageSize and pageMask are too short on WIN64 * Use the eventually true UNICODE imageNameT if -DUNICODE * interpret pluginName as UTF8 rather than pure ASCII * refactor sqMessageBox to void using toUnicode * Discard now unused toUnicode fromUnicode fromSqueak fromSqueak2 lstrrchr * #if 0 ? YAGNI ! we now use builtin _WIN32 _WIN64 anyway * which SetUpPreferences()? There is no SetUpPreferences()! * RegisterWindowMessage takes a TCHAR * * Platform specific knowledge: WIN32_FILE and STD_FILE are mutually exclusive options * We can't compare a TCHAR*windowClassName with a char*buf * Tu quoque NewspeakVM, frustra TEXT macro... * gai_strerror returns a TCHAR*, we cannot simply fprintf it... * Let lookup account for NULL terminating a WCHAR* * Revert to ASCII only version of DnsInfo * iconPath is char*, LoadImage expects a TCHAR* * And account for the fact that iconPath is not NULL-TERMINATED! * DPRINTF must take a TCHAR*fmt because wvsprintf does! * NOTIFYICONDATA.szTip maybe a WCHAR* if -DUNICODE * _DISPLAY_DEVICE.DeviceString may be a WCHAR* if -DUNICODE, we cannot simply sprintf * VM_VERSION_TEXT is a TCHAR*, we cannot simply fprintf * iniName, manufacturer and model may be WCHAR* if -DUNICODE * Information queried in Registry can be WideChar if -DUNICODE * Make stderrName and stdoutName be WCHAR* * Retract support for Windows95 (no you don't dream it's nearly 2019!) * Handle UTF16 logName and serviceName
-- File Changes --
M platforms/win32/plugins/DropPlugin/sqWin32Drop.c (78) M platforms/win32/plugins/FilePlugin/sqWin32FilePrims.c (2) M platforms/win32/plugins/HostWindowPlugin/sqWin32HostWindowPlugin.c (9) M platforms/win32/plugins/SocketPlugin/sqWin32NewNet.c (4) M platforms/win32/vm/sqPlatformSpecific.h (1) M platforms/win32/vm/sqWin32.h (82) M platforms/win32/vm/sqWin32Alloc.c (4) M platforms/win32/vm/sqWin32DnsInfo.c (16) M platforms/win32/vm/sqWin32ExternalPrims.c (5) M platforms/win32/vm/sqWin32Main.c (463) M platforms/win32/vm/sqWin32Prefs.c (18) M platforms/win32/vm/sqWin32Prefs.h (6) M platforms/win32/vm/sqWin32Service.c (307) M platforms/win32/vm/sqWin32SpurAlloc.c (18) M platforms/win32/vm/sqWin32Utils.c (114) M platforms/win32/vm/sqWin32Window.c (103)
-- Patch Links --
https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/332.patch https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/332.diff
@nicolas-cellier-aka-nice pushed 1 commit.
e5cd4fb0538cdd090e7ceb4078edc261cb5099a0 Fix 3 potential buffer overrun
@nicolas-cellier-aka-nice pushed 1 commit.
4ded3182b34a2cc2ac3ec1299590a71515a07972 Fix my own confusion about wcsncat
@nicolas-cellier-aka-nice pushed 1 commit.
af19ed7e15bed953ddbc3d3ab4295683e34d0ab6 Fix: Shlemiel the painter needs to paint strncat too
@nicolas-cellier-aka-nice pushed 1 commit.
bf3840c320cf6cd488d83b1ebf7d0ea124b6ad87 Fix a TCHAR*crashInfo trying to mix a char*msg
@nicolas-cellier-aka-nice pushed 1 commit.
252e2a84a250faa99dbacae6c439ac132b8ca9e7 Fix another potential Buffer overrun in sqWin32MIDI.c
nicolas-cellier-aka-nice commented on this pull request.
WCHAR buffer[256];
DWORD memSize;
/* Argh. It seems that the registry key regularly starts with \Registry\Machine\ which doesn't work with RegOpenKey below. I have no idea why but for now I'll just truncate that part if we recognize it... */ - if (_strnicmp(keyName, "\registry\machine\", 18) == 0) { - memcpy(keyName, keyName+18, strlen(keyName)-17); + if (_wcsnicmp(keyName, L"\registry\machine\", 18) == 0) { + memmove(keyName, keyName+18*sizeof(WCHAR), (wcslen(keyName)-17)*sizeof(WCHAR));
Err: `keyName` is `WCHAR*`, `keyName+18` skips 18 characters, `keyName+18*sizeof(WCHAR)` skips 36 characters!
@nicolas-cellier-aka-nice pushed 1 commit.
3e51616a56a0ef49b7c67a580db0f0fbaaea588f fixup: skip only 18 WCHAR if keyName begins with \registry\machine
nicolas-cellier-aka-nice commented on this pull request.
WCHAR buffer[256];
DWORD memSize;
/* Argh. It seems that the registry key regularly starts with \Registry\Machine\ which doesn't work with RegOpenKey below. I have no idea why but for now I'll just truncate that part if we recognize it... */ - if (_strnicmp(keyName, "\registry\machine\", 18) == 0) { - memcpy(keyName, keyName+18, strlen(keyName)-17); + if (_wcsnicmp(keyName, L"\registry\machine\", 18) == 0) { + memmove(keyName, keyName+18*sizeof(WCHAR), (wcslen(keyName)-17)*sizeof(WCHAR));
Fixed in 3e51616a56a0ef49b7c67a580db0f0fbaaea588f
Merged #332 into Cog.
vm-dev@lists.squeakfoundation.org