Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NtUserEnumDisplayDevices returns NTSTATUS not BOOL #1139

Closed
derekbruening opened this issue Nov 28, 2014 · 1 comment
Closed

NtUserEnumDisplayDevices returns NTSTATUS not BOOL #1139

derekbruening opened this issue Nov 28, 2014 · 1 comment

Comments

@derekbruening
Copy link
Contributor

From [email protected] on February 21, 2013 12:45:28

running win7 calc in full mode and shutting down immediately after it
finishes drawing: r1133 :
Dr.M ERRORS FOUND:
Dr.M 0 unique, 0 total unaddressable access(es)
Dr.M 2 unique, 2 total uninitialized access(es)
Dr.M 0 unique, 0 total invalid heap argument(s)
Dr.M 3 unique, 53 total GDI usage error(s)
Dr.M 0 unique, 0 total warning(s)
Dr.M 6 unique, 62 total, 4188 byte(s) of leak(s)
Dr.M 2 unique, 2 total, 1376 byte(s) of possible leak(s)

HEAD + issue #1133, issue #1137 fixes:
Dr.M ERRORS FOUND:
Dr.M 0 unique, 0 total unaddressable access(es)
Dr.M 53 unique, 197 total uninitialized access(es)
Dr.M 0 unique, 0 total invalid heap argument(s)
Dr.M 3 unique, 53 total GDI usage error(s)
Dr.M 0 unique, 0 total warning(s)
Dr.M 7 unique, 63 total, 5648 byte(s) of leak(s)
Dr.M 0 unique, 0 total, 0 byte(s) of possible leak(s)

many are from:
USER32.dll!EnumDisplayDevicesA

ReactOS has as BOOL. r1133 :
pre-drsyscall:
processing pre system call #0x10f7 NtUserEnumDisplayDevices
pre considering arg 0 8 5
pre considering arg 2 -102 2
pre considering arg 0 0 0
processing post system call #0x10f7 NtUserEnumDisplayDevices res=0x0
post considering arg 0 8 5 0x00000000
post considering arg 2 -102 2 0x003ce9c8
start 0x003ce9c8, size 0x348
marking 0x3ce9c8-0x3ced10 written parameter #2
post considering arg 0 0 0 0x00000000

system call #0x10f7 NtUserEnumDisplayDevices
#0 USER32.dll!EnumDisplayDevicesA+0x68 (0x754c45da <USER32.dll+0x245da>) modid:0
#1 fp=0x003ced14 parent=0x003cef3c gdiplus.dll!DriverMulti::EnumDisplayMonitorsCallback+0xd3 (0x682a76e5 <gdiplus.dll+0xb76e5>) modid:0
#2 fp=0x003cef3c parent=0x003cef70 USER32.dll!__ClientMonitorEnumProc+0x25 (0x754c44fd <USER32.dll+0x244fd>) modid:0

EnumDisplayDevices() returns a BOOL

reactos headers say bool; the impl file
interestingly has NTSTATUS commented out.

win7:
0:002> U 754de5cf
USER32!EnumDisplayDevicesW+0x68:
754de5cf e8e860feff call USER32!NtUserEnumDisplayDevices (754c46bc)
754de5d4 85c0 test eax,eax
754de5d6 7c32 jl USER32!EnumDisplayDevicesW+0x94 (754de60a)
xp32:
0:001> U 7e41e0a3
USER32!EnumDisplayDevicesW+0x79:
7e41e0a3 e8c0a80000 call USER32!NtUserEnumDisplayDevices (7e428968)
7e41e0a8 85c0 test eax,eax
7e41e0aa 7c2e jl USER32!EnumDisplayDevicesW+0xa3 (7e41e0da)

if NtUserEnumDisplayDevices <0, EnumDisplayDevicesW() returns 0: looks like NTSTATUS?

proof:
BOOL success;
DISPLAY_DEVICE device_info;
device_info.cb = sizeof(device_info);

success = EnumDisplayDevices(NULL, 18, &device_info, 0);
printf("got &#37;d\n", success);

success = EnumDisplayDevices(NULL, 0, /* display adapter `#0` */
                             &device_info, 0);
printf("got &#37;d\n", success);

% ./ntuser
got 0
got 1
% bin/drstrace -dr d:/derek/dr/git/exports -- d:/derek/dr/test/ntuser.exe 2>&1 | grep -A 8 NtUserEnumDisplayDevices
NtUserEnumDisplayDevices
arg 0: (type=UNICODE_STRING_, size=0x4)
arg 1: (type=, size=0x4)
arg 2: 0x0026f730 (type=
, size=0x4)
arg 3: (type=, size=0x4)
succeeded =>
arg 2: (type=
, size=0x4)
retval: 0xc0000001 (type=bool, size=0x4)

NtUserEnumDisplayDevices
arg 0: (type=UNICODE_STRING_, size=0x4)
arg 1: (type=, size=0x4)
arg 2: 0x0026f730 (type=
, size=0x4)
arg 3: (type=, size=0x4)
failed =>
arg 2: (type=
, size=0x4)
retval: 0x0 (type=bool, size=0x4)

=> that removes all of the extras:
Dr.M ERRORS FOUND:
Dr.M 0 unique, 0 total unaddressable access(es)
Dr.M 2 unique, 2 total uninitialized access(es)
Dr.M 0 unique, 0 total invalid heap argument(s)
Dr.M 3 unique, 56 total GDI usage error(s)
Dr.M 0 unique, 0 total warning(s)
Dr.M 7 unique, 63 total, 5648 byte(s) of leak(s)
Dr.M 0 unique, 0 total, 0 byte(s) of possible leak(s)

Original issue: http://code.google.com/p/drmemory/issues/detail?id=1139

@derekbruening
Copy link
Contributor Author

From [email protected] on February 21, 2013 14:10:08

This issue was closed by revision r1197 .

Status: Fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant