program for symbolic link

hi,
I am new to windows drivers.
i want to create a link between the user mode application to the kernel mode driver i.e making symboliclink between the application and driver . In Windows NT® 4.0 and earlier versions of the NT-based operating system, drivers named their device objects and then set up symbolic links in the registry between these names and a user-visible Win32® logical name.

For Windows® 2000 and later, drivers do not name device objects. Instead, they make use of device interface classes.

so i want this creation using the device interface class, i.e i want the program for both user application and and driver code to impliment this issue.

it is urgent.
thanks and regards
shiva

xxxxx@yahoo.co.in wrote:

i want to create a link between the user mode application to the kernel mode driver i.e making symboliclink between the application and driver .

Well, your terminology is not quite correct. A driver can create a
symbolic link for itself with a given file name. You don’t make a
symbolic link between an application and a driver.

In Windows NT® 4.0 and earlier versions of the NT-based operating system, drivers named their device objects and then set up symbolic links in the registry between these names and a user-visible Win32® logical name.

For Windows® 2000 and later, drivers do not name device objects. Instead, they make use of device interface classes.

Symbolic links continue to work just fine, even into Vista, if that’s
how you would prefer to access your device. Device interfaces are
another method, with certain advantages (flexibility) and disadvantages
(simplicity).

so i want this creation using the device interface class, i.e i want the program for both user application and and driver code to impliment this issue.

There are many samples in the DDK that do this. The very thorough
“toaster” sample includes a number of example drivers that register a
device interface, and then access that device interface from user-mode apps.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

>so i want this creation using the device interface class, i.e i want the
program for

both user application and and driver code to impliment this issue.

In kernel: IoRegisterDeviceInterface/IoSetDeviceInterfaceState
In user: SetupDiGetClassDevs/SetupDiGetDeviceInterfaceDetail

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

but i am getting how can we call from application program this symbolic link.

that means by which funtion we can call this, and how can we check whether this is success or failure,
i wrote code using iocreatesymboliclink in driver but how to call my device object from application
here i am giving u the code which i modified in filter.c of usb

RtlInitUnicodeString(&devName,L"\Device\ssss");
RtlInitUnicodeString(&symbolicLinkName, SYMBOLIC_NAME_STRING);
/*ends my code*/
status = IoCreateDevice( driverObj,
sizeof(struct DEVICE_EXTENSION),
&devName, // name for this device
FILE_DEVICE_UNKNOWN,
FILE_AUTOGENERATED_DEVICE_NAME, // device characteristics
FALSE, // not exclusive
&filterDevObj); // our device object
//
// It is important that you choose correctly the file type for this
// device object. Here we use FILE_DEVICE_UNKNOWN because this is
// a generic filter, however as will all filters, the creator needs
// to understand to which stack this filter is attaching.
// E.G. if you are writing a CD filter driver you need to use
// FILE_DEVICE_CD_ROM. IoCreateDevice actually creates device object
// with different properties dependent on this field.
//

if (NT_SUCCESS(status)){
struct DEVICE_EXTENSION *devExt;
ASSERT(filterDevObj);
/*my code starts*/
// Point uszDeviceString at the device name

// Create symbolic link to the user-visible name
ntStatus = IoCreateSymbolicLink(&symbolicLinkName,
&devName);
/* my code ens*/

can u please help me out how to load this driver using inf file and can i use the same inf file which is there in usb filter.

in inf file i am using the hardware id as
%USB\VID_045E&PID_0014.DeviceDesc%=QV2KUX,USB\VID_045E&PID_0014
using this how can load and how can verify this symbolic link is created or not

i need application which is calling this symbolic link

thanks and regards
shiva

Tim Roberts wrote:
xxxxx@yahoo.co.in wrote:
> i want to create a link between the user mode application to the kernel mode driver i.e making symboliclink between the application and driver .

Well, your terminology is not quite correct. A driver can create a
symbolic link for itself with a given file name. You don’t make a
symbolic link between an application and a driver.

> In Windows NT® 4.0 and earlier versions of the NT-based operating system, drivers named their device objects and then set up symbolic links in the registry between these names and a user-visible Win32® logical name.
>
> For Windows® 2000 and later, drivers do not name device objects. Instead, they make use of device interface classes.
>

Symbolic links continue to work just fine, even into Vista, if that’s
how you would prefer to access your device. Device interfaces are
another method, with certain advantages (flexibility) and disadvantages
(simplicity).

> so i want this creation using the device interface class, i.e i want the program for both user application and and driver code to impliment this issue.
>

There are many samples in the DDK that do this. The very thorough
“toaster” sample includes a number of example drivers that register a
device interface, and then access that device interface from user-mode apps.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.


Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

Send free SMS to your Friends on Mobile from your Yahoo! Messenger. Download Now! http://messenger.yahoo.com/download.php

::CreateFile :wink: …and you’ll be opening “\\.\sss”

BR,

Rob Linegar
Software Engineer
Data Encryption Systems Limited
www.des.co.uk | www.deslock.com


From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of shiva
Sent: 19 December 2006 09:41
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] program for symbolic link

but i am getting how can we call from application program this symbolic
link.

that means by which funtion we can call this, and how can we check
whether this is success or failure,
i wrote code using iocreatesymboliclink in driver but how to call my
device object from application
here i am giving u the code which i modified in filter.c of usb

RtlInitUnicodeString(&devName,L"\Device\ssss");
RtlInitUnicodeString(&symbolicLinkName, SYMBOLIC_NAME_STRING);
/*ends my code*/
status = IoCreateDevice( driverObj,
sizeof(struct DEVICE_EXTENSION),
&devName, // name for this
device
FILE_DEVICE_UNKNOWN,
FILE_AUTOGENERATED_DEVICE_NAME,
// device characteristics
FALSE, // not exclusive
&filterDevObj); // our device object
//
// It is important that you choose correctly the file type for this
// device object. Here we use FILE_DEVICE_UNKNOWN because this is
// a generic filter, however as will all filters, the creator needs
// to understand to which stack this filter is attaching.
// E.G. if you are writing a CD filter driver you need to use
// FILE_DEVICE_CD_ROM. IoCreateDevice actually creates device
object
// with different properties dependent on this field.
//

if (NT_SUCCESS(status)){
struct DEVICE_EXTENSION *devExt;
ASSERT(filterDevObj);
/*my code starts*/
// Point uszDeviceString at the device name

// Create symbolic link to the user-visible name
ntStatus = IoCreateSymbolicLink(&symbolicLinkName,
&devName);
/* my code ens*/

can u please help me out how to load this driver using inf file and can
i use the same inf file which is there in usb filter.

in inf file i am using the hardware id as
%USB\VID_045E&PID_0014.DeviceDesc%=QV2KUX,USB\VID_045E&PID_0014
using this how can load and how can verify this symbolic link is created
or not

i need application which is calling this symbolic link

thanks and regards
shiva

Tim Roberts wrote:

xxxxx@yahoo.co.in wrote:
> i want to create a link between the user mode application to
the kernel mode driver i.e making symboliclink between the application
and driver .

Well, your terminology is not quite correct. A driver can create
a
symbolic link for itself with a given file name. You don’t make
a
symbolic link between an application and a driver.

> In Windows NT(r) 4.0 and earlier versions of the NT-based
operating system, drivers named their device objects and then set up
symbolic links in the registry between these names and a user-visible
Win32(r) logical name.
>
> For Windows(r) 2000 and later, drivers do not name device
objects. Instead, they make use of device interface classes.
>

Symbolic links continue to work just fine, even into Vista, if
that’s
how you would prefer to access your device. Device interfaces
are
another method, with certain advantages (flexibility) and
disadvantages
(simplicity).

> so i want this creation using the device interface class, i.e
i want the program for both user application and and driver code to
impliment this issue.
>

There are many samples in the DDK that do this. The very
thorough
“toaster” sample includes a number of example drivers that
register a
device interface, and then access that device interface from
user-mode apps.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

Send free SMS to your Friends on Mobile from your Yahoo! Messenger.
Download Now! http://messenger.yahoo.com/download.php — Questions?
First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256 To unsubscribe, visit the
List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

Do not use symbolic links (IoCreateSymbolicLink) in this fashion, use device interfaces instead. Why? Device interfaces provide notifications on arrival, enumeration of separate instances of the device (and since it is usb, there can be more then one!). Old symbolic links created via IoCreateSymbolicLink does not provide either of these functions

d

PS and without knowing what SYMBOLIC_NAME_STRING is defined as, \.\sss is not necessarily the right name, only if SYMBOLIC_NAME_STRING is defined as L"\DosDevices\sss"

From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Rob Linegar
Sent: Tuesday, December 19, 2006 1:52 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] program for symbolic link

::CreateFile? ;-)? …and you’ll be opening “\\.\sss”
?
?
BR,
?
Rob Linegar
Software Engineer
Data Encryption Systems Limited
www.des.co.uk | www.deslock.com


From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of shiva
Sent: 19 December 2006 09:41
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] program for symbolic link
but i am getting how can we call from application program this symbolic link.
?
that means by which funtion we can call this, and how can we check whether this is success or failure,
i wrote code?using iocreatesymboliclink in driver but how to call my device object from application
here i am giving u the code which i modified in filter.c of usb
?
RtlInitUnicodeString(&devName,L"\Device\ssss");
RtlInitUnicodeString(&symbolicLinkName, SYMBOLIC_NAME_STRING);
/*ends my code*/
??? status = IoCreateDevice(??? driverObj,
??? sizeof(struct DEVICE_EXTENSION),
??? &devName,??? // name for this device
??? FILE_DEVICE_UNKNOWN,
??? FILE_AUTOGENERATED_DEVICE_NAME,??? // device characteristics
??? FALSE,??? // not exclusive
??? &filterDevObj); // our device object
??? //
??? // It is important that you choose correctly the file type for this
??? // device object.? Here we use FILE_DEVICE_UNKNOWN because this is
??? // a generic filter, however as will all filters, the creator needs
??? // to understand to which stack this filter is attaching.
??? // E.G. if you are writing a CD filter driver you need to use
??? // FILE_DEVICE_CD_ROM.? IoCreateDevice actually creates device object
??? // with different properties dependent on this field.
??? //

??? if (NT_SUCCESS(status)){
??? struct DEVICE_EXTENSION *devExt;
??? ASSERT(filterDevObj);
/*my code starts*/
??// Point uszDeviceString at the device name
?
?// Create symbolic link to the user-visible name
?ntStatus = IoCreateSymbolicLink(&symbolicLinkName,
??? &devName);
/* my code ens*/
?
can u please help me out?how to load this driver using inf file and can i use the same inf file which is there in usb filter.
?
in inf file i am using the hardware id as
%USB\VID_045E&PID_0014.DeviceDesc%=QV2KUX,USB\VID_045E&PID_0014
using this how can load and how can verify this symbolic link is created or not
?
i need application which is calling this symbolic link
?
thanks and regards
shiva

Tim Roberts wrote:
xxxxx@yahoo.co.in wrote:
> i want to create a link between the user mode application to the kernel mode driver i.e making symboliclink between the application and driver .

Well, your terminology is not quite correct. A driver can create a
symbolic link for itself with a given file name. You don’t make a
symbolic link between an application and a driver.

> In Windows NT? 4.0 and earlier versions of the NT-based operating system, drivers named their device objects and then set up symbolic links in the registry between these names and a user-visible Win32? logical name.
>
> For Windows? 2000 and later, drivers do not name device objects. Instead, they make use of device interface classes.
>

Symbolic links continue to work just fine, even into Vista, if that’s
how you would prefer to access your device. Device interfaces are
another method, with certain advantages (flexibility) and disadvantages
(simplicity).

> so i want this creation using the device interface class, i.e i want the program for both user application and and driver code to impliment this issue.
>

There are many samples in the DDK that do this. The very thorough
“toaster” sample includes a number of example drivers that register a
device interface, and then access that device interface from user-mode apps.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.


Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

Send free SMS to your Friends on Mobile from your Yahoo! Messenger. Download Now! http://messenger.yahoo.com/download.php — Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256 To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer


Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

using this createfile routine i am not able to get handle to the device which i was created,

when i compiled it was shown that create file was unsuccessful by reading it’s return value.

regards
shiva

Rob Linegar wrote:
::CreateFile :wink: …and you’ll be opening “\\.\sss”

BR,

Rob Linegar
Software Engineer
Data Encryption Systems Limited
www.des.co.uk | www.deslock.com

---------------------------------
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of shiva
Sent: 19 December 2006 09:41
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] program for symbolic link

but i am getting how can we call from application program this symbolic link.

that means by which funtion we can call this, and how can we check whether this is success or failure,
i wrote code using iocreatesymboliclink in driver but how to call my device object from application
here i am giving u the code which i modified in filter.c of usb

RtlInitUnicodeString(&devName,L"\Device\ssss");
RtlInitUnicodeString(&symbolicLinkName, SYMBOLIC_NAME_STRING);
/ends my code/
status = IoCreateDevice( driverObj,
sizeof(struct DEVICE_EXTENSION),
&devName, // name for this device
FILE_DEVICE_UNKNOWN,
FILE_AUTOGENERATED_DEVICE_NAME, // device characteristics
FALSE, // not exclusive
&filterDevObj); // our device object
//
// It is important that you choose correctly the file type for this
// device object. Here we use FILE_DEVICE_UNKNOWN because this is
// a generic filter, however as will all filters, the creator needs
// to understand to which stack this filter is attaching.
// E.G. if you are writing a CD filter driver you need to use
// FILE_DEVICE_CD_ROM. IoCreateDevice actually creates device object
// with different properties dependent on this field.
//

if (NT_SUCCESS(status)){
struct DEVICE_EXTENSION devExt;
ASSERT(filterDevObj);
/my code starts/
// Point uszDeviceString at the device name

// Create symbolic link to the user-visible name
ntStatus = IoCreateSymbolicLink(&symbolicLinkName,
&devName);
/
my code ens*/

can u please help me out how to load this driver using inf file and can i use the same inf file which is there in usb filter.

in inf file i am using the hardware id as
%USB\VID_045E&PID_0014.DeviceDesc%=QV2KUX,USB\VID_045E&PID_0014
using this how can load and how can verify this symbolic link is created or not

i need application which is calling this symbolic link

thanks and regards
shiva

Tim Roberts wrote:
xxxxx@yahoo.co.in wrote:
> i want to create a link between the user mode application to the kernel mode driver i.e making symboliclink between the application and driver .

Well, your terminology is not quite correct. A driver can create a
symbolic link for itself with a given file name. You don’t make a
symbolic link between an application and a driver.

> In Windows NT® 4.0 and earlier versions of the NT-based operating system, drivers named their device objects and then set up symbolic links in the registry between these names and a user-visible Win32® logical name.
>
> For Windows® 2000 and later, drivers do not name device objects. Instead, they make use of device interface classes.
>

Symbolic links continue to work just fine, even into Vista, if that’s
how you would prefer to access your device. Device interfaces are
another method, with certain advantages (flexibility) and disadvantages
(simplicity).

> so i want this creation using the device interface class, i.e i want the program for both user application and and driver code to impliment this issue.
>

There are many samples in the DDK that do this. The very thorough
“toaster” sample includes a number of example drivers that register a
device interface, and then access that device interface from user-mode apps.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.


Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

Send free SMS to your Friends on Mobile from your Yahoo! Messenger. Download Now! http://messenger.yahoo.com/download.php — Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256 To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer


Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

Send free SMS to your Friends on Mobile from your Yahoo! Messenger. Download Now! http://messenger.yahoo.com/download.php

this is code from application i tried to get an handle,

/* my code*/

HANDLE hDriver = CreateFile(“L\DosDevices\shiva”,
GENERIC_READ | GENERIC_WRITE,
0,
NULL,
OPEN_EXISTING,
0,
NULL);
if ((hDriver == NULL) || (hDriver == INVALID_HANDLE_VALUE))
{
printf(“Failed to open the driver handle\n”);
return 0;
}
printf(“Successfully opened the driver handle\n”);

*/

i compiled this application then i got

Failed to open the driver handle\n

what is wrong in this.

thanks and regards

shiva
Rob Linegar wrote:
::CreateFile :wink: …and you’ll be opening “\\.\sss”

BR,

Rob Linegar
Software Engineer
Data Encryption Systems Limited
www.des.co.uk | www.deslock.com

---------------------------------
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of shiva
Sent: 19 December 2006 09:41
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] program for symbolic link

but i am getting how can we call from application program this symbolic link.

that means by which funtion we can call this, and how can we check whether this is success or failure,
i wrote code using iocreatesymboliclink in driver but how to call my device object from application
here i am giving u the code which i modified in filter.c of usb

RtlInitUnicodeString(&devName,L"\Device\ssss");
RtlInitUnicodeString(&symbolicLinkName, SYMBOLIC_NAME_STRING);
/ends my code/
status = IoCreateDevice( driverObj,
sizeof(struct DEVICE_EXTENSION),
&devName, // name for this device
FILE_DEVICE_UNKNOWN,
FILE_AUTOGENERATED_DEVICE_NAME, // device characteristics
FALSE, // not exclusive
&filterDevObj); // our device object
//
// It is important that you choose correctly the file type for this
// device object. Here we use FILE_DEVICE_UNKNOWN because this is
// a generic filter, however as will all filters, the creator needs
// to understand to which stack this filter is attaching.
// E.G. if you are writing a CD filter driver you need to use
// FILE_DEVICE_CD_ROM. IoCreateDevice actually creates device object
// with different properties dependent on this field.
//

if (NT_SUCCESS(status)){
struct DEVICE_EXTENSION devExt;
ASSERT(filterDevObj);
/my code starts/
// Point uszDeviceString at the device name

// Create symbolic link to the user-visible name
ntStatus = IoCreateSymbolicLink(&symbolicLinkName,
&devName);
/
my code ens*/

can u please help me out how to load this driver using inf file and can i use the same inf file which is there in usb filter.

in inf file i am using the hardware id as
%USB\VID_045E&PID_0014.DeviceDesc%=QV2KUX,USB\VID_045E&PID_0014
using this how can load and how can verify this symbolic link is created or not

i need application which is calling this symbolic link

thanks and regards
shiva

Tim Roberts wrote:
xxxxx@yahoo.co.in wrote:
> i want to create a link between the user mode application to the kernel mode driver i.e making symboliclink between the application and driver .

Well, your terminology is not quite correct. A driver can create a
symbolic link for itself with a given file name. You don’t make a
symbolic link between an application and a driver.

> In Windows NT® 4.0 and earlier versions of the NT-based operating system, drivers named their device objects and then set up symbolic links in the registry between these names and a user-visible Win32® logical name.
>
> For Windows® 2000 and later, drivers do not name device objects. Instead, they make use of device interface classes.
>

Symbolic links continue to work just fine, even into Vista, if that’s
how you would prefer to access your device. Device interfaces are
another method, with certain advantages (flexibility) and disadvantages
(simplicity).

> so i want this creation using the device interface class, i.e i want the program for both user application and and driver code to impliment this issue.
>

There are many samples in the DDK that do this. The very thorough
“toaster” sample includes a number of example drivers that register a
device interface, and then access that device interface from user-mode apps.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.


Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

Send free SMS to your Friends on Mobile from your Yahoo! Messenger. Download Now! http://messenger.yahoo.com/download.php — Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256 To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer


Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

Send free SMS to your Friends on Mobile from your Yahoo! Messenger. Download Now! http://messenger.yahoo.com/download.php

IIRC, the \DosDevices does not exist in user mode under that name, you have to use \.. Also remember that in C/C++ to get a single '' in a string you need to use two \'s, so for \.\ the string would be L"\\.\“, so to open your device you need to use the string L”\\.\shiva".

One further point of confusion is that you have the L inside the string. I am guessing you did this to get your app to compile which means you are not defined UNICODE and _UNICODE to use wide characters. In this case you would use “\\.\shiva” instead

d


From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of shiva
Sent: Tuesday, December 19, 2006 8:43 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] program for symbolic link

this is code from application i tried to get an handle,
?
/* my code*/
?
HANDLE hDriver = CreateFile(“L\DosDevices\shiva”,
???GENERIC_READ | GENERIC_WRITE,
???0,
???NULL,
???OPEN_EXISTING,
???0,
???NULL);
??if ((hDriver == NULL) || (hDriver == INVALID_HANDLE_VALUE))
??{
???printf(“Failed to open the driver handle\n”);
???return 0;
??}
??printf(“Successfully opened the driver handle\n”);
?
*/
?
i compiled this application then i got
?
Failed to open the driver handle\n
?
what is wrong in this.
?
thanks and regards
?
shiva
Rob Linegar wrote:
::CreateFile? ;-)? …and you’ll be opening “\\.\sss”
?
?
BR,
?
Rob Linegar
Software Engineer
Data Encryption Systems Limited
www.des.co.uk | www.deslock.com
________________________________________
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of shiva
Sent: 19 December 2006 09:41
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] program for symbolic link
but i am getting how can we call from application program this symbolic link.
?
that means by which funtion we can call this, and how can we check whether this is success or failure,
i wrote code?using iocreatesymboliclink in driver but how to call my device object from application
here i am giving u the code which i modified in filter.c of usb
?
RtlInitUnicodeString(&devName,L"\Device\ssss");
RtlInitUnicodeString(&symbolicLinkName, SYMBOLIC_NAME_STRING);
/ends my code/
??? status = IoCreateDevice(??? driverObj,
??? sizeof(struct DEVICE_EXTENSION),
??? &devName,??? // name for this device
??? FILE_DEVICE_UNKNOWN,
??? FILE_AUTOGENERATED_DEVICE_NAME,??? // device characteristics
??? FALSE,??? // not exclusive
??? &filterDevObj); // our device object
??? //
??? // It is important that you choose correctly the file type for this
??? // device object.? Here we use FILE_DEVICE_UNKNOWN because this is
??? // a generic filter, however as will all filters, the creator needs
??? // to understand to which stack this filter is attaching.
??? // E.G. if you are writing a CD filter driver you need to use
??? // FILE_DEVICE_CD_ROM.? IoCreateDevice actually creates device object
??? // with different properties dependent on this field.
??? //

??? if (NT_SUCCESS(status)){
??? struct DEVICE_EXTENSION devExt;
??? ASSERT(filterDevObj);
/my code starts/
??// Point uszDeviceString at the device name
?
?// Create symbolic link to the user-visible name
?ntStatus = IoCreateSymbolicLink(&symbolicLinkName,
??? &devName);
/
my code ens*/
?
can u please help me out?how to load this driver using inf file and can i use the same inf file which is there in usb filter.
?
in inf file i am using the hardware id as
%USB\VID_045E&PID_0014.DeviceDesc%=QV2KUX,USB\VID_045E&PID_0014
using this how can load and how can verify this symbolic link is created or not
?
i need application which is calling this symbolic link
?
thanks and regards
shiva

Tim Roberts wrote:
xxxxx@yahoo.co.in wrote:
> i want to create a link between the user mode application to the kernel mode driver i.e making symboliclink between the application and driver .

Well, your terminology is not quite correct. A driver can create a
symbolic link for itself with a given file name. You don’t make a
symbolic link between an application and a driver.

> In Windows NT? 4.0 and earlier versions of the NT-based operating system, drivers named their device objects and then set up symbolic links in the registry between these names and a user-visible Win32? logical name.
>
> For Windows? 2000 and later, drivers do not name device objects. Instead, they make use of device interface classes.
>

Symbolic links continue to work just fine, even into Vista, if that’s
how you would prefer to access your device. Device interfaces are
another method, with certain advantages (flexibility) and disadvantages
(simplicity).

> so i want this creation using the device interface class, i.e i want the program for both user application and and driver code to impliment this issue.
>

There are many samples in the DDK that do this. The very thorough
“toaster” sample includes a number of example drivers that register a
device interface, and then access that device interface from user-mode apps.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.


Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

Send free SMS to your Friends on Mobile from your Yahoo! Messenger. Download Now! http://messenger.yahoo.com/download.php — Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256 To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer


Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

Send free SMS to your Friends on Mobile from your Yahoo! Messenger. Download Now! http://messenger.yahoo.com/download.php — Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256 To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

hi,

thanks i tried with u r code, it is working, now i want to implement same thing that is creating the symbolic link using the “ioregisterdeviceclass”, which will be used in windows2000 and later versions,
for that i need the hint from both application point of view and driver point of view,

and how to create class guid

thanks and regards
shiva
Doron Holan wrote:
IIRC, the \DosDevices does not exist in user mode under that name, you have to use \.. Also remember that in C/C++ to get a single '' in a string you need to use two \'s, so for \.\ the string would be L"\\.\“, so to open your device you need to use the string L”\\.\shiva".

One further point of confusion is that you have the L inside the string. I am guessing you did this to get your app to compile which means you are not defined UNICODE and UNICODE to use wide characters. In this case you would use “\\.\shiva” instead

d


From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of shiva
Sent: Tuesday, December 19, 2006 8:43 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] program for symbolic link

this is code from application i tried to get an handle,

/* my code*/

HANDLE hDriver = CreateFile(“L\DosDevices\shiva”,
GENERIC_READ | GENERIC_WRITE,
0,
NULL,
OPEN_EXISTING,
0,
NULL);
if ((hDriver == NULL) || (hDriver == INVALID_HANDLE_VALUE))
{
printf(“Failed to open the driver handle\n”);
return 0;
}
printf(“Successfully opened the driver handle\n”);

*/

i compiled this application then i got

Failed to open the driver handle\n

what is wrong in this.

thanks and regards

shiva
Rob Linegar wrote:
::CreateFile :wink: …and you’ll be opening “\\.\sss”

BR,

Rob Linegar
Software Engineer
Data Encryption Systems Limited
www.des.co.uk | www.deslock.com
_
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of shiva
Sent: 19 December 2006 09:41
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] program for symbolic link
but i am getting how can we call from application program this symbolic link.

that means by which funtion we can call this, and how can we check whether this is success or failure,
i wrote code using iocreatesymboliclink in driver but how to call my device object from application
here i am giving u the code which i modified in filter.c of usb

RtlInitUnicodeString(&devName,L"\Device\ssss");
RtlInitUnicodeString(&symbolicLinkName, SYMBOLIC_NAME_STRING);
/ends my code/
status = IoCreateDevice( driverObj,
sizeof(struct DEVICE_EXTENSION),
&devName, // name for this device
FILE_DEVICE_UNKNOWN,
FILE_AUTOGENERATED_DEVICE_NAME, // device characteristics
FALSE, // not exclusive
&filterDevObj); // our device object
//
// It is important that you choose correctly the file type for this
// device object. Here we use FILE_DEVICE_UNKNOWN because this is
// a generic filter, however as will all filters, the creator needs
// to understand to which stack this filter is attaching.
// E.G. if you are writing a CD filter driver you need to use
// FILE_DEVICE_CD_ROM. IoCreateDevice actually creates device object
// with different properties dependent on this field.
//

if (NT_SUCCESS(status)){
struct DEVICE_EXTENSION devExt;
ASSERT(filterDevObj);
/my code starts/
// Point uszDeviceString at the device name

// Create symbolic link to the user-visible name
ntStatus = IoCreateSymbolicLink(&symbolicLinkName,
&devName);
/
my code ens*/

can u please help me out how to load this driver using inf file and can i use the same inf file which is there in usb filter.

in inf file i am using the hardware id as
%USB\VID_045E&PID_0014.DeviceDesc%=QV2KUX,USB\VID_045E&PID_0014
using this how can load and how can verify this symbolic link is created or not

i need application which is calling this symbolic link

thanks and regards
shiva

Tim Roberts wrote:
xxxxx@yahoo.co.in wrote:
> i want to create a link between the user mode application to the kernel mode driver i.e making symboliclink between the application and driver .

Well, your terminology is not quite correct. A driver can create a
symbolic link for itself with a given file name. You don’t make a
symbolic link between an application and a driver.

> In Windows NT® 4.0 and earlier versions of the NT-based operating system, drivers named their device objects and then set up symbolic links in the registry between these names and a user-visible Win32® logical name.
>
> For Windows® 2000 and later, drivers do not name device objects. Instead, they make use of device interface classes.
>

Symbolic links continue to work just fine, even into Vista, if that’s
how you would prefer to access your device. Device interfaces are
another method, with certain advantages (flexibility) and disadvantages
(simplicity).

> so i want this creation using the device interface class, i.e i want the program for both user application and and driver code to impliment this issue.
>

There are many samples in the DDK that do this. The very thorough
“toaster” sample includes a number of example drivers that register a
device interface, and then access that device interface from user-mode apps.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.


Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

Send free SMS to your Friends on Mobile from your Yahoo! Messenger. Download Now! http://messenger.yahoo.com/download.php — Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256 To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer


Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

Send free SMS to your Friends on Mobile from your Yahoo! Messenger. Download Now! http://messenger.yahoo.com/download.php — Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256 To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer


Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

Send free SMS to your Friends on Mobile from your Yahoo! Messenger. Download Now! http://messenger.yahoo.com/download.php

hi,
thanks , but here i need to create class guid, can u please help me out how to create class guid and how to use it in the code.
and how can i verify this program is successful?

thanks and regards
shiva

“Maxim S. Shatskih” wrote:
>so i want this creation using the device interface class, i.e i want the
program for
>both user application and and driver code to impliment this issue.

In kernel: IoRegisterDeviceInterface/IoSetDeviceInterfaceState
In user: SetupDiGetClassDevs/SetupDiGetDeviceInterfaceDetail

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com


Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

Send free SMS to your Friends on Mobile from your Yahoo! Messenger. Download Now! http://messenger.yahoo.com/download.php

run

uuidgen /s

and copy and paste the output to your header, editting the name as appopriate for your driver…
although it does not appear that uuidgen is a part of the WDK, it is a part of the SDK.