DynamoRIO / DynamoRIO/drmemory

False reports due to CreateProcessAsUser & friends

Open
#14 3 comments 0 reactions 0 assignees View on GitHub
Bug-FalsePositive Migrated OpSys-Windows Priority-Medium
Dominant language
C
Stars
2.7k
Forks
290
PR merge metrics
No merged PRs in 30d

Description

_From [timurrrr@google.com](https://code.google.com/u/timurrrr@google.com/) on July 22, 2010 07:49:10_

On Windows XP, the following code gives 30+ reports:
#

#include
#include

#pragma comment(lib, "userenv.lib")
#pragma comment(lib, "advapi32.lib")

#include
#include

int main(void) {
HANDLE token;
assert(OpenProcessToken(GetCurrentProcess(), TOKEN_ALL_ACCESS, &token));

STARTUPINFO startup_info = {0};
startup_info.cb = sizeof(startup_info);

void\* env_block = NULL;
assert(CreateEnvironmentBlock(&env_block, token, FALSE));

PROCESS_INFORMATION proc_info = {0};
BOOL launched = CreateProcessAsUser(token, NULL,
"C:\Windows\system32\ping.exe www.google.com",
NULL, NULL, FALSE, CREATE_UNICODE_ENVIRONMENT,
env_block, NULL, &startup_info, &proc_info);
DestroyEnvironmentBlock(env_block);

if (!launched) {
printf("FAIL\n");
return 1;
}

CloseHandle(proc_info.hThread);
CloseHandle(proc_info.hProcess);
printf("OK\n");
return 0;
}
#

cl /Zi test.cpp && drmemory.exe -- test.exe

**Attachment:** [results.txt](http://code.google.com/p/drmemory/issues/detail?id=14)

_Original issue: http://code.google.com/p/drmemory/issues/detail?id=14_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.