Please see the code:
int main(int argc,LPTSTR argv[])
{
HANDLE hinFile;
BOOL check;
PLARGE_INTEGER file_size;
hinFile=CreateFile(argv[1],GENERIC_READ,FILE_SHARE_READ,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
if(hinFile==INVALID_HANDLE_VALUE)
{printf("INVALID_HANDLE_VALUE\nFile Does Not Exist");exit(0);}
else{
check=GetFileSizeEx(hinFile,file_size);
printf("The Size of File is %d",file_size);
}
return 0;
}
Now, in the above program whether i try to open a file in directory of the Executable or i specify the path as command line arguments, the only output i get is: INVALID_HANDLE_VALUE\nFile Does Not Exist
Please Explain why this is happening?