Solved

CreateFile for VXD's with absolute paths?

Posted on 1999-01-20
3
403 Views
Last Modified: 2013-12-03
Hi Expersts!!!

 I develop a dynamic VxD , and I use:  

myCF= CreateFile("\\\\.\\VMYD.VXD",0,0,0, CREATE_NEW,FILE_FLAG_DELETE_ON_CLOSE,0);
....
 
BUT I want a NEW path to load my vxd, I want load my vxd from the C:\windows\system\  

what can I do??

any Idea??

Thanks for all!.
0
Comment
Question by:hpyam
  • 2
3 Comments
 
LVL 15

Accepted Solution

by:
Tommy Hui earned 330 total points
Comment Utility
This is from the MSDN library:

Opening the VxD
You can open a static or dynamically loadable VxD by specifying the module name, filename, or registry entry identifying the VxD in a call to the CreateFile function. If the VxD exists and it supports the device IOCTL interface, the function returns a device handle that you can use in subsequent calls to the DeviceIoControl function. Otherwise, the function fails and sets the last error value to ERROR_NOT_SUPPORTED or ERROR_FILE_NOT_FOUND. You can use the GetLastError function to retrieve the error value.

When you open a VxD, you must specify a name having the following form.

\\.\VxdName
 
VxDName can be the module name of the VxD, the name of the VxD file, or the name of a registry entry that specifies the filename.

CreateFile checks for a filename extension to determine whether VxDName specifies a file. If a filename extension (such as .VXD) is present, the function looks for the file in the standard search path. In the following example, CreateFile looks for the SAMPLE.VXD file in the standard search path.

HANDLE hDevice;

hDevice = CreateFile("\\\\.\\SAMPLE.VXD", 0, 0, NULL, 0,
    FILE_FLAG_DELETE_ON_CLOSE, NULL);
 
If VxDName has no filename extension, CreateFile checks the registry to see if the name is also a value name under the KnownVxDs key in HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\SessionManager. If it is a value name, CreateFile uses the current value associated with the name as the full path of the VxD file. This method is useful for specifying VxDs that are not in the standard search path. In the following example, CreateFile searches the registry for the MYVXDPATH value.

hDevice = CreateFile("\\\\.\\MYVXDPATH", 0, 0, NULL, 0,
    FILE_FLAG_DELETE_ON_CLOSE, NULL);
 
If VxDName has no filename extension and is not in the registry, CreateFile assumes that the name is a VxD module name and searches the internally maintained device descriptor blocks for an already loaded VxD having the given name. In the following example, CreateFile opens the standard VxD named VWIN32.VXD.

hDevice = CreateFile("\\\\.\\VWIN32", 0, 0, NULL, 0,
    0, NULL);
 
In all cases, if CreateFile cannot find or load the VxD, it sets the last error value to ERROR_FILE_NOT_FOUND. If the function loads the VxD but the VxD does not support the device IOCTL interface, CreateFile sets the last error value to ERROR_NOT_SUPPORTED.

You can open the same VxD any number of times. CreateFile provides a unique handle each time you open a VxD, but it makes sure that no more than one copy of the VxD is loaded into memory. To ensure that the system removes the VxD from memory when you close the last instance of the VxD, use the FILE_FLAG_DELETE_ON_CLOSE value when opening dynamically loadable VxDs. Static VxDs cannot be removed from memory.

Although CreateFile has several parameters, only the lpName and fdwAttrsAndFlags parameters are useful when opening an VxD. fdwAttrsAndFlags can be zero, the FILE_FLAG_DELETE_ON_CLOSE value, or the FILE_FLAG_OVERLAPPED value. FILE_FLAG_OVERLAPPED is used for asynchronous operation and is described later in this article.

0
 

Author Comment

by:hpyam
Comment Utility
Thanks thui.... butyou are not undertastand my question

I want load my vmyd.vxd from the path c:\windows\system\  

**  what I need write in the create file parameter which path! **

I need change the standart path! with a new path!  

Thanks Again.
0
 

Author Comment

by:hpyam
Comment Utility
by sample
ANDLE hDevice;

    hDevice = CreateFile("\\\\.\\c:\windows\system\SAMPLE.VXD", 0, 0, NULL, 0,
        FILE_FLAG_DELETE_ON_CLOSE, NULL);

is correct the path??

what form of path I need write to load my vmyd.vxd from the c:\windows\system\  
(I copied my dynamic vxd inside the c:\windows\system\  ,...
I load my vxd dynamicly

what can I write to my path is true ??

Thanks!


0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

zlib is a free compression library (a DLL) on which the popular gzip utility is built.  In this article, we'll see how to use the zlib functions to compress and decompress data in memory; that is, without needing to use a temporary file.  We'll be c…
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now