Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change
Quote0x80000002Still not sure why it causes a fault, but I need a break from debugging.
STATUS_DATATYPE_MISALIGNMENT
{EXCEPTION} Alignment Fault
A data type misalignment was detected in a load or store instruction.
Quote from: NoCforMe on March 30, 2025, 11:21:41 AMWell, nobody has yet answered sinsi's question:Maybe nobody here knows for certain.QuoteWonder why align 4 is so important?
QuoteMy guess®™ is that somewhere in the code for ReadDirectoryChangesW() they explicitly check the buffer alignment, I'm guessing in the interest of speed.
QuoteWonder why align 4 is so important?
Quote from: Greenhorn on December 19, 2024, 07:12:59 AMThe alignment is important because the FILE_NOTIFY_INFORMATION structure is variable in length, because of it's last member FileName.There was a discussion a couple of years ago about this. Marinus suggested me to align 16 and 32 for performance in a certain code.
The other structure members are DWORDs, so you must align at 4 bytes (at least?).
8 byte and 16 byte alignment should also work ?! But this is just a guess by myself.
Quote from: sinsi on March 30, 2025, 07:03:24 AMI would add one thingThanks Sinsi. I was actually, adding the zero termination in my call. But since I am using the length function, I thought that was too muchsub eax, 1
A byte-by-byte copy is fine here since button text is usually not very long
jnz @B
mov [esi].char[ebx], al ;<< zero-terminate the destination string
done:![]()
Quote from: _japheth on March 29, 2025, 09:26:24 PMCould this be a bug in JWASM v2.14 from Dec 20 2020? - No, it's still there in the current version.Thanks for testing.
QuoteInstead of an answer, here's the relevant JWasm code ( cpumodel.c ) - or rather the data definitions:
#define INIT_LANG 0x1
#define INIT_STACK 0x2
#define INIT_OS 0x4
struct typeinfo {
uint_8 value; /* value assigned to the token */
uint_8 init; /* kind of token */
};
static const char * const ModelAttr[] = {
"NEARSTACK", "FARSTACK", "OS_OS2", "OS_DOS" };
static const struct typeinfo ModelAttrValue[] = {
{ STACK_NEAR, INIT_STACK },
{ STACK_FAR, INIT_STACK },
{ OPSYS_DOS, INIT_OS },
{ OPSYS_OS2, INIT_OS },
};
A little riddle: can you see the bug just be examining that data?
static const struct typeinfo ModelAttrValue[] = {
{ STACK_NEAR, INIT_STACK },
{ STACK_FAR, INIT_STACK },
{ OPSYS_DOS, INIT_OS },
{ OPSYS_OS2, INIT_OS },
};
and it must be changed as follows:static const struct typeinfo ModelAttrValue[] = {
{ NEARSTACK, INIT_STACK },
{ FARSTACK, INIT_STACK },
{ OS_DOS, INIT_OS },
{ OS_OS2, INIT_OS },
};
of the order of OPSYS_DOS and OPSYS_OS2 needs to be swapped.static const struct typeinfo ModelAttrValue[] = {
{ STACK_NEAR, INIT_STACK },
{ STACK_FAR, INIT_STACK },
{ OPSYS_OS2, INIT_OS },
{ OPSYS_DOS, INIT_OS },
};
If STACK_NEAR, STACK_FAR, OPSYS_OS2, and OPSYS_DOS are defined somewhere outside of your code snippet, then I suspect the latter.static const struct typeinfo ModelAttrValue[] = {
{ NEARSTACK, INIT_STACK },
{ FARSTACK, INIT_STACK },
{ OS_OS2, INIT_OS },
{ OS_DOS, INIT_OS },
};
It's also possible that the wrong values are being assigned. OPSYS_OS2 and OPSYS_DOS are given exactly the same value. Perhaps one of them should be INIT_LANG? INIT_LANG is not used anywhere and it may well be that the value in the struct is used later for differentiation and is therefore dependent on the correctly assigned value. On the other hand, OS/2 and DOS are both operating systems, so the value INIT_OS could also be correct. It just depends on what the rest of the code says.QuoteI guess it's a bug that exists since the very beginning of jwasm - that is 03/2008, so it celebrates its 17th birthday these days.Great, then I found a bug in JWASM, which can be fixed, and JWASM will have one less bug in future versions.
Quote from: sinsi on March 30, 2025, 08:47:50 AMA bit off-topic but I don't like resources due to the fact that it is easy to change them (BeginUpdateResource etc.)Well, here's another small advantage I see to not using resources in this case (menus):
Anything from a practical joke (hah, this menu says "shit" lol) to nasty (infected images).
Quote from: zedd151 on March 30, 2025, 07:49:09 AMScroll down to see what TPM_VERNEGANIMATION does. "Animates menu from bottom to top". Probably works fine without it.Probably.
Quote from: sinsi on March 30, 2025, 08:47:50 AMA bit off-topic but I don't like resources due to the fact that it is easy to change them (BeginUpdateResource etc.)Then again it's easy to change any strings with a hex editor, whether it is in resources or not. If a hacker/spammer/script kiddie is determined enough, not a lot can be done to stop them entirely, if that is the type of thing that you are talking about.
Anything from a practical joke (hah, this menu says "shit" lol) to nasty (infected images).