5 ms·
The ugliness of the windows API never ceases to amaze me. Functions with names like RtlDetermineDosPathNameType_U and return types like PCWSTR just make my eyes
by voldacar 7y ago
The ugliness of the windows API never ceases to amaze me. Functions with names like RtlDetermineDosPathNameType_U and return types like PCWSTR just make my eyes bleed.
- colatkinson 7y agoMy personal favorite is PCZZWSTR: a const pointer to a contiguous WCHAR array, where each substring is NUL-terminated, and the array itself is also terminated by a NUL. Thus (I assume) the ZZ--zero zero. I've only ever seen it used in the SHFILEOPSTRUCTW struct.
- wtallis 7y agoThat reads like one of the instruction mnemonics from https://twitter.com/x86instructions https://twitter.com/x86instructions
- voldacar 7y ago>SHFILEOPSTRUCTW now that takes the cake
- whoopdedo 7y agoNah. That would be INITCOMMONCONTROLSEX. And the related LVM_SORTITEMSEX, DDSCAPSEX, and of course MPR_CREDENTIALSEX_0.
- saagarjha 7y agoWith Microsoft's use of ALLCAPS and using an "Ex" prefix, this was all but guaranteed…
- msclrhd 7y agoHow about SHITEMID in the shlwapi DLL? That's supposed to be SH-ITEM-ID.
- Barrin92 7y agoif someone ever figures out the meaning of that phrase it's probably going to summon some cosmic horror that will be the end of us all
- therein 7y agoI've had some interesting experiences with SHFileOperationA on Wine. Star Citizen's updater wasn't working properly at one point due to it.
- alxmdev 7y agoMulti-strings are also pretty common in the registry, see REG_MULTI_SZ.
- asveikau 7y agoI feel like that construct, sometimes called "double-null terminated", is often inaccurately described. I prefer to think of it as a contiguous block of null terminated strings terminated by an empty string. (Just as '\0' terminates a C string, the empty string terminates such a list.)
- deleted 7y ago[deleted]
- deleted 7y ago[deleted]
- Const-me 7y agoThat's not an API. The article talks about some ntdll function, not supported by MS, and not documented by MS. The ugliness might be deliberate, to make developers conclude "that must be some Windows internal BS, probably undocumented" when they see it in debugger, profiler or other places.
- asveikau 7y ago> The ugliness might be deliberate, to make developers conclude "that must be some Windows internal BS, probably undocumented" when they see it in debugger, profiler or other places. Not at all. It is consistently named with internal NT APIs that are used like that intentionally. The people working at that layer follow such naming conventions without irony.
- Const-me 7y ago> consistently named with internal NT APIs I know, but these are mostly not part of WinAPI either. The public API surface has very good names, WriteFile or CreateDirectory is IMO better than POSIX write or mkdir.
- wvenable 7y agoMy favorite Unix function has to be "creat". It doesn't even make sense given the limitations of the systems at the time.
- cyphar 7y agoIt definitely makes you wonder whether the 'E' key was broken on the machines at Bell Labs. In all seriousness, Ken Thompson was asked what was the one thing we wanted to change in Unix if he could, and his answer was that he would spell "creat" with an "e"[1]. And funnily enough, he actually did in Go[2]. [1]: https://unix.stackexchange.com/questions/10893/what-did-ken-thompson-mean-when-he-said-id-spell-creat-with-an-e https://unix.stackexchange.com/questions/10893/what-did-ken-... [2]: https://github.com/golang/go/commit/c90d392ce3d3203e0c32b3f98d1e68c4c2b4c49b https://github.com/golang/go/commit/c90d392ce3d3203e0c32b3f9...