Forum posts for smss.exe

Geting the file size of a system application on windows in C++

I am trying to get the file size of a system application on windows. To test this i have created a test application that tries to get the file size of smss.exe in C:WindowsSystem32smss.exe but it fails with error: ERROR_FILE_NOT_FOUND. The file does actually exist (i have checked). I've also tried different methods for getting the file size, with: FindFirstFile, CreateFile and GetFileSizeEx. But all return the same error. I would also like to read the file contents.

What am i doing wrong?

The code:

// Test.cpp : Defines the entry point for the console application.
//

#include 'stdafx.h'

#include <windows.h>
#include <stdio.h>
#include <tchar.h>
#include <iostream>

__int64 getFileSize(LPWSTR filePath)
{
WIN32_FILE_ATTRIBUTE_DATA fad;
if (!GetFileAttributesEx(filePath, GetFileExInfoStandard, &fad))
{
_tprintf(TEXT(' CAnt get file size for file %s error %d'), filePath, GetLastError());
return 0;
}
LARGE_INTEGER size;
size.HighPart = fad.nFileSizeHigh;
size.LowPart = fad.nFileSizeLow;
return size.QuadPart;
}

int _tmain(int argc, _TCHAR* argv[])
{
_tprintf(TEXT('File size %d '), getFileSize(L'C:\Windows\System32\smss.exe'));
}

View complete forum thread with replies

Other posts related to smss.exe

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

Can&#39;t list all process on windows 7 64 bit
C# Kill all processes not essential to running Windows
Geting the file size of a system application on windows in C++
how to compile to reduce memory /STACK doesn&#39;t seem to change anything?
custom search bar on my custom homepage
Strange character in textoutput when piping from tasklist command WIN7
Replacing winlogon.exe in windows embedded
Can a wmic processes table (within the command prompt window) be sorted by a value?
Subprocess.Popen() : hide the cmd shell

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.