Zebediah Figura (@zfigura) commented about dlls/cfgmgr32/tests/cfgmgr32.c:
{ CR_QUERY_VETOED, DEFAULT_ERROR },
{ CR_CANT_SHARE_IRQ, DEFAULT_ERROR },
{ CR_NO_DEPENDENT, DEFAULT_ERROR },
{ CR_SAME_RESOURCES, DEFAULT_ERROR },
{ CR_DEVICE_INTERFACE_ACTIVE, DEFAULT_ERROR },
{ CR_INVALID_CONFLICT_LIST, DEFAULT_ERROR },
{ CR_INVALID_INDEX, DEFAULT_ERROR },
{ CR_INVALID_STRUCTURE_SIZE, DEFAULT_ERROR },
{ NUM_CR_RESULTS, DEFAULT_ERROR },
- };
- SetLastError(0xdeadbeef);
- ret = 0;
- ret = CM_MapCrToWin32Err( 0xdeadbeef, DEFAULT_ERROR );
- ok( ret == DEFAULT_ERROR, "expected default error, got %ld.\n", ret );
- ok( GetLastError() == 0xdeadbeef, "unexpected error %ld.\n", GetLastError() );
The fact that DEFAULT_ERROR is 0xdeadbeef makes the GetLastError() test less interesting.
The fact that DEFAULT_ERROR is a macro makes this above observation less obvious, which is one reason I would just write it out everywhere.
(Also, there's a dead assignment to "ret" in here.)