RE: USD Wiper with DoD 5220.22-M 04-29-2019, 07:49 PM
#11
(04-29-2019, 06:34 PM)IsBadWritePtr Wrote: Yea, english is not my native and was too early in the morning to give enough attention on your comments, I find strange how ULONG_PTR tilts you, and using char or short is very bad design for a for loop and that thing will bite you in the a**, so you don't mind to be used char, but you find confusing ULONG_PTR ? "You could have also used a regular pointer" ULONG_PTR has the same size as a pointer (does that count ?) but its increase by 1 not by its type (int* will increase by 4 bytes, this is what i mean), if i know this thing will start a war between int and ULONG_PTR will start, i would have mixed tabs with spaces to pour salt in everyones wound, a little bit of VIM vs EMACS, and say that GCC sucks. Are you the type of guy that uses signed int ?
4 spaces > 1 tab
VIM > EMACS
Watcom > GCC
Windows > Linux
Edge > Chrome
Starwars suck
Why would char would be bad design here and not ULONG_PTR? Both are going to do equally the same thing but char will use less stack space (even though that's not my argument here). I don't understand how it would do any harm in this particular case either since all your values for the physical disk string numeric component can fit into 8 bits... You don't need this kind of precompiler logic for what you're doing however:
Code:
#if defined(_WIN64)
typedef unsigned __int64 ULONG_PTR;
#else
typedef unsigned long ULONG_PTR;
#endif
The reason this type exists is to store a pointer address, and the size of a pointer changes depending on architecture, which implies this is a mis-use of the type semantically.
As for the pointer arithmetic problem; unsigned char* would do similar.
-- My point: wrong with the standard primitive int types here? It's what everyone else does, optimized for x86 arch, plain and easy to read, basically de facto standard, and you don't need unsigned __int64, or unsigned long for a 0-15 range.
I'm not saying it doesn't work, but it would be like using a 64-bit integer to store a boolean state. Why not just match with the types you're already using? Yes obfuscated code works too as another example, but there's a reason why people don't normally write code like that.
(This post was last modified: 04-29-2019, 07:55 PM by 0xDEAD10CC.)