Hi,
When i try to assign the handler retured from createfile2() to a void pointer which i passed from my application, my application is giving the following error "Unhandled exception at 0x000007F612102079 in AppToTestPlatform.exe: 0xC0000005: Access violation
writing location 0x0000000000000000"
Sample code:
terror File_Open(void* fp, char *fName, eFileOpenMode aMode)
{
HANDLE hdl = NULL;
tError lStatus;
// convert the string file name to LPCWSTR
UINT a = strlen(fName);
BSTR unicodefName = SysAllocStringLen(NULL, a);
::MultiByteToWideChar(CP_ACP, 0, fName, a, unicodefName, a);
hdl = CreateFile2(unicodefName, GENERIC_READ, FILE_SHARE_READ, OPEN_EXISTING,0);
lStatus = GetLastError();
if(lStatus == ERROR_ALREADY_EXISTS || lStatus == NO_ERROR)
{
*fp = (tFileHandle)hdl;// Getting Error on this line <<---
return E_SUCCESS;
}
}
void*handle=nullptr;
char name[]={"C:\\Users\\win8\\AppData\\Local\\Packages\\54ed7c5f-b7d8-4842-bbf1-b6dabe9918f6_913w5jmqyr9pt\\LocalState\\Sample.txt"};//Creating a file in application local folder
int32 result=File_Open(handle, name, WRITE_MODE);
what are the possible cause for the above ?