Closed saschanaz closed 8 months ago
@saschanaz Are you building this with Visual Studio?
Nope.
If this is the same issue I ran into on a separate project, the answer was to #include <windows.h>
instead of winuser.h
in the RC file. (I don't have any special knowledge as a MSFT employee here, just ran into a similar issue myself a while back.)
This is correct, windows.h defines the macros identifying the target arch. There's a reason almost all winapi docs say "header.h (include windows.h)"
Well, my point is that:
//
// Note: RC_INVOKED is checked in PROBE_ALIGNMENT to maintain compatibility with previous
// versions of the SDK which did not block inclusion in an .RC file.
//
#if defined(_AMD64_) || defined(_X86_) || defined(_ARM64EC_)
#define PROBE_ALIGNMENT( _s ) TYPE_ALIGNMENT( DWORD )
#elif defined(_IA64_) || defined(_ARM_) || defined(_ARM64_)
//
// TODO: WOWXX - Unblock ARM. Make all alignment checks DWORD for now.
//
#define PROBE_ALIGNMENT( _s ) TYPE_ALIGNMENT( DWORD )
#elif !defined(RC_INVOKED)
#error "No Target Architecture"
#endif
This compatibility is now broken.
winuser.h
isn't meant for RC files. It should be winuser.rh
, but including windows.h
figures that out. I don't know exactly when this was changed, but it caught me out too.
Basically, don't include winuser.h
directly (which was always the instruction, but I guess a sample came out at some point that led us astray).
closing as comments above seem to have resolved the issue.
When building Firefox with the new Windows 11 SDK:
Here, the
module.rc
is autogenerated and looks like this: https://searchfox.org/mozilla-central/rev/7e36862b61622889b28492d60564dbab1e6d8bbf/config/create_rc.pyAnd the error is from
SYSTEM_CACHE_ALIGNMENT_SIZE
definition:Looking at winnt.h, I found this comment:
I guess
SYSTEM_CACHE_ALIGNMENT_SIZE
should get the same treatment asPROBE_ALIGNMENT
and there should beRC_INVOKED
check, or does Windows 11 SDK now blocks inclusion in an .RC file?See also https://bugzilla.mozilla.org/show_bug.cgi?id=1721208.