CreateFile on win98

Hi everyone,
I use CreateFile on win98 to open a device file. The device has
registered.I can use softice command “device” to see it. But Createfile
return error.
My codes like this:

#define NT_DEVICE_NAME L"\Device\MYDRIVER"
#define DOS_DEVICE_NAME L"\DosDevices\MYDRIVER"

RtlInitUnicodeString(&DeviceName,NT_DEVICE_NAME);
RtlInitUnicodeString(&SymbolicName,DOS_DEVICE_NAME);

Status=IoCreateDevice (DriverObject,
0,
&DeviceName,
FILE_DEVICE_UNKNOWN,
0,
FALSE,
&deviceObject);

Status = IoCreateSymbolicLink(&SymbolicName,&DeviceName);

In the application ,
hFile=CreateFile(TEXT(“\\.\MYDRIVER”),0,0,
NULL,
OPEN_EXISTING,FILE_FLAG_RANDOM_ACCESS,
0
);
Can someone tell me why createfile fail on win98?
Where to find the symboliclink name (DosDevice name ) of a device on
win98?
Thanks in Advance.


Äú¿ÉÒÔÔÚ MSN Hotmail Õ¾µã http://www.hotmail.com/cn Ãâ·ÑÊÕ·¢µç×ÓÓʼþ


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

Hi,

What does GetLastError() return ? This will be more
information to judge on the problem you have stated.
Also, check giving different name of the driver in the
NT_DEVICE_NAME and DOS_DEVICE_NAME - “NT_MYDRIVER” and

“MYDRIVER” resp.

Cheers,
Jay

— ÕÔôá ÕÔôá wrote:
> Hi everyone,
> I use CreateFile on win98 to open a device file.
> The device has
> registered.I can use softice command “device” to see
> it. But Createfile
> return error.
> My codes like this:
>
> #define NT_DEVICE_NAME L"\Device\MYDRIVER"
> #define DOS_DEVICE_NAME L"\DosDevices\MYDRIVER"
> …
> RtlInitUnicodeString(&DeviceName,NT_DEVICE_NAME);
>
> RtlInitUnicodeString(&SymbolicName,DOS_DEVICE_NAME);
>
> Status=IoCreateDevice (DriverObject,
> 0,
> &DeviceName,
> FILE_DEVICE_UNKNOWN,
> 0,
> FALSE,
> &deviceObject);
> …
> Status =
> IoCreateSymbolicLink(&SymbolicName,&DeviceName);
> …
> In the application ,
> hFile=CreateFile(TEXT(“\\.\MYDRIVER”),0,0,
> NULL,
>
> OPEN_EXISTING,FILE_FLAG_RANDOM_ACCESS,
> 0
> );
> Can someone tell me why createfile fail on win98?
> Where to find the symboliclink name (DosDevice
> name ) of a device on
> win98?
> Thanks in Advance.
>
>
>
_______________
> Äú¿ÉÒÔÔÚ MSN Hotmail Õ¾µã http://www.hotmail.com/cn
> Ãâ·ÑÊÕ·¢µç×ÓÓʼþ
>
>
> —
> You are currently subscribed to ntdev as:
> xxxxx@yahoo.com
> To unsubscribe send a blank email to
leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


Do You Yahoo!?
Find a job, post your resume.
http://careers.yahoo.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

When I ported NDISUIO from the XP DDK to Windows 98SE/ME, I had to change

hFile=CreateFile(TEXT(“\\.\MYDRIVER”)…

to

hFile=CreateFile(TEXT(“\\.\\MYDRIVER”)…

in the user-space console app (testuio.c). Give this a try.

Bryan S. Burgin
xxxxx@microsoft.com

This posting is provided “AS IS” with no warranties, and confers no rights. You assume all risk for your use. ? 2001 Microsoft Corporation. All rights reserved.

-----Original Message-----
From: jayadev m n [mailto:xxxxx@yahoo.com]
Sent: Sunday, November 04, 2001 10:59 PM
To: NT Developers Interest List
Subject: [ntdev] Re: CreateFile on win98

Hi,

What does GetLastError() return ? This will be more
information to judge on the problem you have stated.
Also, check giving different name of the driver in the
NT_DEVICE_NAME and DOS_DEVICE_NAME - “NT_MYDRIVER” and

“MYDRIVER” resp.

Cheers,
Jay

— ??? ??? wrote:
> Hi everyone,
> I use CreateFile on win98 to open a device file.
> The device has
> registered.I can use softice command “device” to see
> it. But Createfile
> return error.
> My codes like this:
>
> #define NT_DEVICE_NAME L"\Device\MYDRIVER"
> #define DOS_DEVICE_NAME L"\DosDevices\MYDRIVER"
> …
> RtlInitUnicodeString(&DeviceName,NT_DEVICE_NAME);
>
> RtlInitUnicodeString(&SymbolicName,DOS_DEVICE_NAME);
>
> Status=IoCreateDevice (DriverObject,
> 0,
> &DeviceName,
> FILE_DEVICE_UNKNOWN,
> 0,
> FALSE,
> &deviceObject);
> …
> Status =
> IoCreateSymbolicLink(&SymbolicName,&DeviceName);
> …
> In the application ,
> hFile=CreateFile(TEXT(“\\.\MYDRIVER”),0,0,
> NULL,
>
> OPEN_EXISTING,FILE_FLAG_RANDOM_ACCESS,
> 0
> );
> Can someone tell me why createfile fail on win98?
> Where to find the symboliclink name (DosDevice
> name ) of a device on
> win98?
> Thanks in Advance.
>
>
>
_______________
> ??? MSN Hotmail վ?? http://www.hotmail.com/cn
> ???շ???ʼ?
>
>
> —
> You are currently subscribed to ntdev as:
> xxxxx@yahoo.com
> To unsubscribe send a blank email to
leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


Do You Yahoo!?
Find a job, post your resume.
http://careers.yahoo.com


You are currently subscribed to ntdev as: xxxxx@microsoft.com
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

I have tried to change hFile=CreateFile(TEXT(“\\.\MYDRIVER”)…
to hFile=CreateFile(TEXT(“\\.\\MYDRIVER”)…but it still fails.
GetLastError return 2. I have checked the name ,
I have changed
#define NT_DEVICE_NAME L"\Device\MYDRIVER"
#define DOS_DEVICE_NAME L"\DosDevices\MYDRIVER"
to
#define NT_DEVICE_NAME L"\Device\MYDRIVER"
#define DOS_DEVICE_NAME L"\DosDevices\DOS_MYDRIVER".
But CreateFile strill returns fail. My driver is .sys. In MSDN documents,on
win98,
to open a vxd ,you can use hFile=CreateFile(TEXT(“\\.\MYDRIVER”)… ,it
means to open MYDRIVER.vxd. How can I open .sys file ?
I can see all device names with softice command “device”. But it can’t
see the symboliclink names. I want to know whether the symboliclink names
exist on win98 or not?
thanks for your help.
zhaoling


Äú¿ÉÒÔÔÚ MSN Hotmail Õ¾µã http://www.hotmail.com/cn Ãâ·ÑÊÕ·¢µç×ÓÓʼþ


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

I’am not a driver expert, but I think you forgot device id assigned by
device enumerator, so the call will be:
hFile=CreateFile(TEXT(“\\.\MYDRIVERn”)
where n is the id number starting from 0.
Michele

Original Message -----
From: “??? ???”
To: “NT Developers Interest List”
Cc: ; <“mailto:m"@yahoo.com
Sent: Friday, November 09, 2001 8:57 AM
Subject: [ntdev] Re: CreateFile on win98

> I have tried to change hFile=CreateFile(TEXT(”\\.\MYDRIVER")…
> to hFile=CreateFile(TEXT(“\\.\\MYDRIVER”)…but it still fails.
> GetLastError return 2. I have checked the name ,
> I have changed
> #define NT_DEVICE_NAME L"\Device\MYDRIVER"
> #define DOS_DEVICE_NAME L"\DosDevices\MYDRIVER"
> to
> #define NT_DEVICE_NAME L"\Device\MYDRIVER"
> #define DOS_DEVICE_NAME L"\DosDevices\DOS_MYDRIVER".
> But CreateFile strill returns fail. My driver is .sys. In MSDN
documents,on
> win98,
> to open a vxd ,you can use hFile=CreateFile(TEXT(“\\.\MYDRIVER”)…
,it
> means to open MYDRIVER.vxd. How can I open .sys file ?
> I can see all device names with softice command “device”. But it can’t
> see the symboliclink names. I want to know whether the symboliclink names
> exist on win98 or not?
> thanks for your help.
> zhaoling
>
> _________________________________________________________________
> ??? MSN Hotmail վ?? http://www.hotmail.com/cn ???շ???ʼ?
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@htl.it
> To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

I have a feeling that you are probably “barking up the wrong tree”. However,
here goes.

First of all, CreateFile simply cannot be used to load .SYS drivers on
Windows 98. Sorry. It can be used to open them after they are loaded, but
not to load them…

If you are trying to load a .SYS driver on Windows 98 it should be of one of
several special “Windows Driver Model” (WDM) or “miniport” types.

If it is a WDM driver, then the installation is fairly complex at first
glance. Books like Walter Oney’s “Programming for the Windows Driver Model”
give fairly clear introductory descriptions. In addition, you may be able to
decipher the DDK documentation and examine the “toaster” WDM sample to get
on your feet.

WDM drivers are almost always associated with hardware, and are loaded using
a “Plug-And-Play” mechanism that involve bus drivers, etc.

Since you are using VtoolsD, perhaps you also have DriverWorks. There may be
some WDM samples there, although I have not looked.

However, if my memory serves you are probably more interested in NDIS
drivers.

NDIS drivers on Windows 98 are loaded by the NDIS wrapper. The drill is to
build an appropriate .INF file and install the NDIS miniport driver using
the Network Control Panel Applet (NCPA). Having done this instalation, NDIS
will detect your miniport’s hardware and load your driver in a fashion
similar to PnP WDM’s.

If, for some bizzare reason, you are interested in dynamically loading a
.SYS NDIS protocol driver, then there is one additional option that can be
made to work. That is to use the NtKernLoadDriver VxD service. This can only
be called (AFAIK) from a helper VxD.

That’s all the help I have. Don’t ask me for more…

Good luck,

Thomas F. Divine

PCAUSA - Toolkits & Resources For Network Software Developers
NDIS Protocol - NDIS Intermediate - TDI Client/Filter
http: - http:

----- Original Message -----
From: “??? ???”
To: “NT Developers Interest List”
Cc: ; <“mailto:m"@yahoo.com
Sent: Friday, November 09, 2001 2:57 AM
Subject: [ntdev] Re: CreateFile on win98

> I have tried to change hFile=CreateFile(TEXT(”\\.\MYDRIVER")…
> to hFile=CreateFile(TEXT(“\\.\\MYDRIVER”)…but it still fails.
> GetLastError return 2. I have checked the name ,
> I have changed
> #define NT_DEVICE_NAME L"\Device\MYDRIVER"
> #define DOS_DEVICE_NAME L"\DosDevices\MYDRIVER"
> to
> #define NT_DEVICE_NAME L"\Device\MYDRIVER"
> #define DOS_DEVICE_NAME L"\DosDevices\DOS_MYDRIVER".
> But CreateFile strill returns fail. My driver is .sys. In MSDN
documents,on
> win98,
> to open a vxd ,you can use hFile=CreateFile(TEXT(“\\.\MYDRIVER”)…
,it
> means to open MYDRIVER.vxd. How can I open .sys file ?
> I can see all device names with softice command “device”. But it can’t
> see the symboliclink names. I want to know whether the symboliclink names
> exist on win98 or not?
> thanks for your help.
> zhaoling
>


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com</http:></http:>

Hi,

Friday, November 09, 2001, 10:57:46 AM, you wrote:

ÕÕ> I have tried to change hFile=CreateFile(TEXT(“\\.\MYDRIVER”)…
ÕÕ> to hFile=CreateFile(TEXT(“\\.\\MYDRIVER”)…but it still fails.
ÕÕ> GetLastError return 2. I have checked the name ,
ÕÕ> I have changed
ÕÕ> #define NT_DEVICE_NAME L"\Device\MYDRIVER"
ÕÕ> #define DOS_DEVICE_NAME L"\DosDevices\MYDRIVER"
ÕÕ> to
ÕÕ> #define NT_DEVICE_NAME L"\Device\MYDRIVER"
ÕÕ> #define DOS_DEVICE_NAME L"\DosDevices\DOS_MYDRIVER".
ÕÕ> But CreateFile strill returns fail. My driver is .sys. In MSDN documents,on
ÕÕ> win98,
ÕÕ> to open a vxd ,you can use hFile=CreateFile(TEXT(“\\.\MYDRIVER”)… ,it
ÕÕ> means to open MYDRIVER.vxd. How can I open .sys file ?
ÕÕ> I can see all device names with softice command “device”. But it can’t
ÕÕ> see the symboliclink names. I want to know whether the symboliclink names
ÕÕ> exist on win98 or not?
ÕÕ> thanks for your help.
ÕÕ> zhaoling

ÕÕ> _________________________________________________________________
ÕÕ> Äú¿ÉÒÔÔÚ MSN Hotmail Õ¾µã http://www.hotmail.com/cn Ãâ·ÑÊÕ·¢µç×ÓÓʼþ

ÕÕ> —
ÕÕ> You are currently subscribed to ntdev as: xxxxx@infpres.com
ÕÕ> To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

Yes, symbolic links do exist in Windows 98. Windows 98 does support
loading of both WDM and former KMD NT drivers. You can load KMD
drivers only at boot time cuz Windows 98 doesn’t have the Service Manager
(as in Windows NT/2k). But you can add a KMD driver to “Services”
registry branch by writing some REG-file, for example:

[HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\MYDRIVER]
“ImagePath”=“\SystemRoot\System32\Drivers\mydriver.sys”
“ErrorControl”=dword:00000001
“Start”=dword:00000001
“Type”=dword:00000001
“DisplayName”=“Sample Windows Driver”
“Group”=“Base”
“Tag”=dword:00000200

Yes, Windows 98 supports “Group” and “Tag” values. When NTKERN.VXD loads
drivers it builds a driver list taking into account an order in which
these drivers must be loaded (according to “Group” and “Tag” values,
and also to “GroupOrderList” and “ServiceGroupOrder”).

Strange, but I wrote some apps which perfectly worked with KMD drivers
under Windows 98.


Best regards,
Konstantin mailto:xxxxx@infpres.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

Hi,

DOS_DEVICENAME is the name recognized by applications, then if you have
changed your DOS_DEVICENAME do you need call CreateFile with the new
DOS_DEVICENAME, in your case \\.\DOS_MYDRIVER

Best Regards,

Heldai Lemos Ferreira
Device Driver Developer
xxxxx@scuasecurity.com.br
www.scuasecurity.com.br
Tel.: 55 11 3106-2299
----- Original Message -----
From: “??? ???”
To: “NT Developers Interest List”
Cc: ; <“mailto:m"@yahoo.com
Sent: Friday, November 09, 2001 5:57 AM
Subject: [ntdev] Re: CreateFile on win98

> I have tried to change hFile=CreateFile(TEXT(”\\.\MYDRIVER")…
> to hFile=CreateFile(TEXT(“\\.\\MYDRIVER”)…but it still fails.
> GetLastError return 2. I have checked the name ,
> I have changed
> #define NT_DEVICE_NAME L"\Device\MYDRIVER"
> #define DOS_DEVICE_NAME L"\DosDevices\MYDRIVER"
> to
> #define NT_DEVICE_NAME L"\Device\MYDRIVER"
> #define DOS_DEVICE_NAME L"\DosDevices\DOS_MYDRIVER".
> But CreateFile strill returns fail. My driver is .sys. In MSDN
documents,on
> win98,
> to open a vxd ,you can use hFile=CreateFile(TEXT(“\\.\MYDRIVER”)…
,it
> means to open MYDRIVER.vxd. How can I open .sys file ?
> I can see all device names with softice command “device”. But it can’t
> see the symboliclink names. I want to know whether the symboliclink names
> exist on win98 or not?
> thanks for your help.
> zhaoling
>
> _________________________________________________________________
> ??? MSN Hotmail վ?? http://www.hotmail.com/cn ???շ???ʼ?
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@scuasecurity.com.br
> To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
>


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com