From: MikeTheRed on
Hello,

I'm trying to write my first driver for WinXP using the latest DDK from
MS. I'm having a few problems (understatment).

Mainly I need to access some ports and send the data to a VB app. I
have decided to use the READ_PORT_XXXX and WRITE_PORT_XXXX wrapers from
NTDDK.h. This means I will be writing a kernal-mode driver.

Now I am trying to get the DriverEntry procedure at least entered into
my code. The first time I ran Build I received the following error
bufferoverflowk.lib(gs_support.obj) : error LNK2019: unresolved
external symbol _DriverEntry@8 referenced in function _GsDriverEntry@8

So i added the following to one of the .H files :
extern "C" {
NTSTATUS __stdcall DriverEntry(
PDRIVER_OBJECT DriverObject,
PUNICODE_STRING RegistryPath
);
}

When I run build I get this error:
c:\WINDDK\FLASH_XP_Driver\New_Code.h(21) : error C2059: syntax error :
'string'

Line 21 is the extern "C" { line from above.

Could anyone give me some advice to get the DriverEntry section to
compile without errors?

Thanks.

Mike

From: Don Burn on
For a first driver, avoid C++, take a look at
http://www.microsoft.com/whdc/driver/kernel/KMcode.mspx to see why this can
be a challenge.

The dirty little secret of driver writing, is almost everyone starts with an
existing driver. Consider taking one of the simpler samples from
src\general, make a copy, be sure it can build, then start applying your
changes.



--
Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
Remove StopSpam from the email to reply




<MikeTheRed(a)Hotmail.com> wrote in message
news:1131401099.471860.173450(a)o13g2000cwo.googlegroups.com...
> Hello,
>
> I'm trying to write my first driver for WinXP using the latest DDK from
> MS. I'm having a few problems (understatment).
>
> Mainly I need to access some ports and send the data to a VB app. I
> have decided to use the READ_PORT_XXXX and WRITE_PORT_XXXX wrapers from
> NTDDK.h. This means I will be writing a kernal-mode driver.
>
> Now I am trying to get the DriverEntry procedure at least entered into
> my code. The first time I ran Build I received the following error
> bufferoverflowk.lib(gs_support.obj) : error LNK2019: unresolved
> external symbol _DriverEntry@8 referenced in function _GsDriverEntry@8
>
> So i added the following to one of the .H files :
> extern "C" {
> NTSTATUS __stdcall DriverEntry(
> PDRIVER_OBJECT DriverObject,
> PUNICODE_STRING RegistryPath
> );
> }
>
> When I run build I get this error:
> c:\WINDDK\FLASH_XP_Driver\New_Code.h(21) : error C2059: syntax error :
> 'string'
>
> Line 21 is the extern "C" { line from above.
>
> Could anyone give me some advice to get the DriverEntry section to
> compile without errors?
>
> Thanks.
>
> Mike
>


From: Maxim S. Shatskih on
Name the DriverEntry function literally = "DriverEntry". This is like
main().

--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
maxim(a)storagecraft.com
http://www.storagecraft.com

<MikeTheRed(a)Hotmail.com> wrote in message
news:1131401099.471860.173450(a)o13g2000cwo.googlegroups.com...
> Hello,
>
> I'm trying to write my first driver for WinXP using the latest DDK from
> MS. I'm having a few problems (understatment).
>
> Mainly I need to access some ports and send the data to a VB app. I
> have decided to use the READ_PORT_XXXX and WRITE_PORT_XXXX wrapers from
> NTDDK.h. This means I will be writing a kernal-mode driver.
>
> Now I am trying to get the DriverEntry procedure at least entered into
> my code. The first time I ran Build I received the following error
> bufferoverflowk.lib(gs_support.obj) : error LNK2019: unresolved
> external symbol _DriverEntry@8 referenced in function _GsDriverEntry@8
>
> So i added the following to one of the .H files :
> extern "C" {
> NTSTATUS __stdcall DriverEntry(
> PDRIVER_OBJECT DriverObject,
> PUNICODE_STRING RegistryPath
> );
> }
>
> When I run build I get this error:
> c:\WINDDK\FLASH_XP_Driver\New_Code.h(21) : error C2059: syntax error :
> 'string'
>
> Line 21 is the extern "C" { line from above.
>
> Could anyone give me some advice to get the DriverEntry section to
> compile without errors?
>
> Thanks.
>
> Mike
>


 | 
Pages: 1
Prev: USB Keyboard LED
Next: HPET support