Forum posts for spoolsv.exe

Calling fopen on Windows core files returns NULL pointer

I am trying to open a couple different files via their absolute path (determined elsewhere, programmatically), so I can get their SHA1 hash*, some of which are core windows files. fopen() is returning NULL on some (but not all) files when I attempt to open them as follows (normally the filename is gotten via QueryFullProcessImageName but I hardcoded it just in case):

char * filename = 'c:\windows\system32\spoolsv.exe';
FILE * currFileRead = fopen(filename, 'rb');
if (currFileRead == NULL)
{
printf('Failed to open %s, error %s ', filename, strerror(errno) );
}
else
{
//hashing code
}


The reported error is 2: 'No such file or directory', but obviously they're there. It also only fails for some processes, like spoolsv.exe or winlogon.exe, while svchost.exe and wininint.exe seem to open just fine.

My program has administrative privileges, and I can't figure why some processes would fail while others opened without trouble?

*I'm using a method from LibTomCrypt (http://libtom.org/?page=features) which is open source with a permissive license. The call to sha1_process takes in a hash_state (internal to the library), an unsigned char buffer, and the length of the buffer. I need to read the file with fopen to get the file into memory for hashing.

View complete forum thread with replies

Other posts related to spoolsv.exe

See Related Forum Messages: Follow the Links Below to View Complete Thread

How can I automate the Tasklist command on my workstation to check a specific process on X n…
Calling fopen on Windows core files returns NULL pointer
How to check if service spoolsv.exe is responding to requests without printing?
Spooler memory increases when System.Printing.Printqueue object is created
Limiting an ATL exe server to one process (instance) only
Squeezing more speed out of Windows print spooler

What is the carbon footprint of your coffee?

Is it low? Is it high? Can this things really kill the planet Earth? Maybe the answer will surprise you. Maybe not.