EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Problem with InstallDriver

Also by EldoS: SecureBlackbox
200+ components and classes for digital security, signing, encryption and secure networking.
#32543
Posted: 03/09/2015 05:05:08
by Yaniv Bitton (Basic support level)
Joined: 03/09/2015
Posts: 4

Hi,

I run VS2013 , run as administrator,

I have a problem with debuggin/running a first test install driver ,

I'm running on Win7 32bit, a static lib user API application,

I added D:\Program Files\EldoS\RawDisk\CPP\VC2013\32bit\static_runtime(MT)\ to the project includes,

I added D:\Program Files\EldoS\RawDisk\CPP\VC2013\32bit\static_runtime(MT) to the linker additional library Directories

I added "RawDisk.lib" to Additional Dependencies

this is my code :

Code
#include <iostream>
#include <string>
#include <stdlib.h>
#include <stdio.h>

#include "rawdisk.h"

void main() {
   BOOL * RebootNeeded;// = FALSE;
   LPCWSTR lDriverName;// = "rawdsk3.sys";
   LPCSTR lProductName;// = "testingEldos";
   LPBOOL lDriverInstalled = false;
   LPDWORD lFileVersionHigh = 0;
   LPDWORD lFileVersionLow = 0;
   SERVICE_STATUS * lServiceStatus = 0;
   BOOL lServiceInstalled;
   printf("Hellow Worls \n");



   lDriverName = (LPCWSTR)"rawdsk3.sys";
   //lDriverName = (LPCWSTR)"elrawdisk.sys";
   lProductName = (LPCSTR)"testingEldos";

   CRawDisk* MyRawDisk = new CRawDisk();

   MyRawDisk->InstallDriver(lDriverName, lProductName, (LPBOOL)&RebootNeeded);
   
   exit(10);
}


I'm getting an exeption on InstallDriver:
"First-chance exception at 0x7469812F in testingEldosLibApplication Empty1.0.exe: Microsoft C++ exception: ERDError at memory location 0x001DF43C."

Please advice,

Best Regards,
Yaniv
#32546
Posted: 03/09/2015 07:34:43
by Eugene Mayevski (EldoS Corp.)

Please try passing the full name (i.e. with drive letter and directory path) in the first parameter.


Sincerely yours
Eugene Mayevski
#32552
Posted: 03/09/2015 08:57:24
by Yaniv Bitton (Basic support level)
Joined: 03/09/2015
Posts: 4

Hi,

I tried :

Code
   lDriverName = (LPCWSTR)"D:\Program Files\EldoS\RawDisk\Drivers\debug\32bit\rawdsk3.sys";


and
Code
lDriverName = (LPCWSTR)"D:\\Program Files\\EldoS\\RawDisk\\Drivers\\debug\\32bit\\rawdsk3.sys";



Still got the same exeption:
Quote
First-chance exception at 0x7469812F in testingEldosLibApplication Empty1.0.exe: Microsoft C++ exception: ERDError at memory location 0x002AF4F4.

If there is a handler for this exception, the program may be safely continued.


I took a look at the memory at 0x002AF4F4: there is a string says like "the system cannot find the file specified ....."

Yaniv
#32557
Posted: 03/09/2015 12:50:19
by Volodymyr Zinin (EldoS Corp.)

Quote
Yaniv Bitton wrote:
lDriverName = (LPCWSTR)"D:\Program Files\EldoS\RawDisk\Drivers\debug\32bit\rawdsk3.sys";

This is not correct because '\' is considered to be escape symbol.

Quote
Yaniv Bitton wrote:
lDriverName = (LPCWSTR)"D:\\Program Files\\EldoS\\RawDisk\\Drivers\\debug\\32bit\\rawdsk3.sys";

This is not correct too because a string in the char format is represented as a unicode string.

Try this one.
lDriverName = (LPCWSTR)L"D:\\Program Files\\EldoS\\RawDisk\\Drivers\\debug\\32bit\\rawdsk3.sys";
#32629
Posted: 03/15/2015 07:46:11
by Yaniv Bitton (Basic support level)
Joined: 03/09/2015
Posts: 4

Hi Zinin ,

Thanks for the help,

Now, after installing the driver i got:
lFileVersionHigh = 0x00030001
lFileVersionLow = 0x0023008d
lServiceInstalled = 0x00000001

I also succeeded to "open" a handle to a disk,
Code
   lDeviceName = (LPCWSTR)L"\\??\\F:";
lDiskHandle = MyRawDisk->Open(lDeviceName, GENERIC_READ, lLicenseKey);

lDiskHandle = 0x00000118

to GetSectorCount and sector size:
Code
   LONGLONG lNumOfSectors;
   LONGLONG lSectorSize;   
lNumOfSectors = MyRawDisk->GetSectorCount(lDiskHandle);
   lSectorSize = MyRawDisk->GetSectorSize(lDiskHandle);

lNumOfSectors = 0x000000000950e800
lSectorSize = 0x0000000000000200


I also open a handle to a Physicaldrive using OpenPhysicalMemoryForReading:
Code
   HANDLE lPhysicalMemoryHandle;
lPhysicalMemoryHandle = MyRawDisk->OpenPhysicalMemoryForReading((LPWSTR)lLicenseKey);

lPhysicalMemoryHandle 0x0000011c void *

I have a problem with creating:
Code
   LPCWSTR lFileName;
   LPCWSTR lLicenseKey;
lFileName = (LPCWSTR)L"TestingEldos";
   MyRawDisk->CreateFileA(lFileName, GENERIC_WRITE, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, (LPWSTR)lLicenseKey);


It fail on compilation (linker):
1>Main.obj : error LNK2019: unresolved external symbol "public: static void * __cdecl CRawDisk::CreateFileA(wchar_t const *,unsigned long,unsigned long,unsigned long,wchar_t const *)" (?CreateFileA@CRawDisk@@SAPAXPB_WKKK0@Z) referenced in function _main[/QUOTE]

Please advice,

Best Regards,
Yaniv
#32630
Posted: 03/15/2015 08:46:45
by Eugene Mayevski (EldoS Corp.)

RawDisk doesn't have CreateFileA method. The class contains only "CreateFile" method.

As WinAPI redefines CreateFile as CreateFileA for non-Unicode target and as CreateFileW for Unicode target, in RawDsik this name is changed to CreateFileW (we provide libraries only for Unicode target). Try to call CreateFileW explicitly in your code and pass Unicode strings in both first and last parameters of the call (if you check documentation, you'll see that they are always unsigned short* which is what LPCWSTR resolves to).


Sincerely yours
Eugene Mayevski
#32691
Posted: 03/22/2015 02:31:26
by Yaniv Bitton (Basic support level)
Joined: 03/09/2015
Posts: 4

Thanks Eugene ,

All it needed (as you suggested) was to changed it to unicode,

I add to the first begging raw:
Code
#define UNICODE 1


now it is working,

Best Regards,
Yaniv
Also by EldoS: Solid File System
A virtual file system that offers a feature-rich storage for application documents and data with built-in compression and encryption.

Reply

Statistics

Topic viewed 6335 times

Number of guests: 1, registered members: 0, in total hidden: 0




|

Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!