Re: Need help in exporting API for Kernel Mode DLL to Application

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



If you want a more function-oriented API, you could provide a library, or
even a user-mode DLL, that exports some API-type calls, which in turn open
the driver and send it suitable IOCTL values behind the scenes.

Paul T.

"Luca Calligaris" <LucaCalligaris@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in
message news:7BD84678-DBA1-4EF3-BD17-FA9AF7EA70EF@xxxxxxxxxxxxxxxx
You cannot call into a kernel DLL from a user application that way. Why
don't
you handle a custom IOCTL_MYTEST in MYD_IOControl and call DeviceIoControl
from your app?
--
Luca Calligaris
www.eurotech.it


"Bhushan" wrote:

Hi All,

I am facing some problem in exporting kernel mode Driver DLL API to
Application in wince 6.0.
I am exporting API using .def file as follows

MYDLL.def looks as below

LIBRARY MYDLL.dll

EXPORTS
MYD_Init @1
MYD_Deinit @2
MYD_Open @3
MYD_Close @4
MYD_Draw @5
MYD_IOControl @6
MYD_PowerDown @7
MYD_PowerUp @8
MYDTest @9

I am calling MYDTEST() function in application
and header file have following declaration in .h for application

__declspec(dllimport) void __cdecl MYDTest(void);

function defination looks as follows
void __cdecl MYDTest(void)
{
.... some code.

}
Compiling and linking is fine. no errors and no warnings.
Driver is loaded in kernel mode.gets loaded and MYD_Init and open and
close functions are called.


When this MYDTest is called in application, compilation and linking is
good.
while running when clicked on icon on touch screen to open the
application nothing happens.
Not even print on first line from WinMain function appears.

when I used dumpbin /expotrs for MYDLL.lib following is the out put

DUMP of Mydll.lib is

Dump of file D:\MYDLL.lib

File Type: LIBRARY
Exports
ordinal name
4 MYD_Close
2 MYD_Deinit
5 MYD_Draw
6 MYD_IOControl
1 MYD_Init
3 MYD_Open
7 MYD_PowerDown
8 MYD_PowerUp
9 MYDTest
Summary
BD .debug$S
14 .idata$2
14 .idata$3
4 .idata$4
4 .idata$5
A .idata$6

and with dumpbin /all is

21 public symbols
3C2 __IMPORT_DESCRIPTOR_MYD
5E2 __NULL_IMPORT_DESCRIPTOR 716
MYD_NULL_THUNK_DATA
9F6 MYD_Init
9F6 __imp_MYD_Init
8C8 MYD_Deinit
8C8__imp_MYD_Deinit
A58 MYD_Open
A58 __imp_MYD_Open
864 MYD_Close
864 __imp_MYD_Close
92C MYD_Draw
92C __imp_MYDE_Draw
98E MYD_IOControl
98E __imp_MYD_IOControl
ABA MYDE_PowerDown
ABA __imp_MYD_PowerDown
B22 MYD_PowerUp
B22 __imp_MYD_PowerUp
B88 __imp_MYDTest
B88 MYDTest

I have also tried using following instead of .def but result is same.
__declspec(dllexport) void __cdecl MYDTest(void)
{
.... some code.

}
Sources file looks as follows
TARGETNAME=MYDLL
TARGETTYPE=DYNLINK
RELEASETYPE=PLATFORM
DEFFILE=MYDLL.def



TARGETLIBS= \
$(_COMMONSDKROOT)\lib\$(_CPUINDPATH)\coredll.lib

SOURCES = \
MYDLL.cpp

Moment is link the MYDLL.lib to application, application wont start
executing after clicking on the touch screen of my test device.

When not linked with this DLL application works fine.

Is there any thing missing,
Any Inputs would be of great help,

Thanks and regards
Bhushan k



.



Relevant Pages

  • Re: RUNDLL32.EXE
    ... 0x66800000 0x155000 Windows Shell Common Dll ... 0x75FA0000 0xA000 BSD Socket API for Windows ... 0x794D0000 0x15000 Microsoft WinSock Extension APIs ...
    (comp.security.firewalls)
  • Re: ZoneAlarm -- Alert for "Run a DLL"
    ... I am blocking it from accessing the internet also... ... DLL file called SENSAPI.DLL. ... 0x60000000 0x5000 SENS Connectivity API DLL ... 0x794D0000 0x15000 Microsoft WinSock Extension APIs ...
    (comp.security.firewalls)
  • Re: API PrntDlg function
    ... You're supposed to also follow the instructions to register the DLL using ... more or less the same job without requiring you to use any API functions. ... anything to the chosen printer you still need to use the VB Printer Object ... printing methods in the normal way. ...
    (microsoft.public.vb.general.discussion)
  • Re: Polymorphism using DLL Declares?
    ... same API. ... MustOverride prototypes for the DLL calls, ... SecondDll, and ThirdDll, and have the Declares override the DLL api ... Public MustInherit Class PublicApi ...
    (microsoft.public.dotnet.languages.vb)
  • Re: API PrntDlg function
    ... When you have done that, and in order to use the dll, you should start a new VB project and use the Project / References menu to set a reference to Microsoft VB Printer Dialog, which you should find in the scrollable list if you registered the DLL properly. ... There was once a rather large block of code on the MSDN pages which used various API functions to display a printer dialog and it included some code allowing you to set up various start parameters for the dialog and to read the results after your user had made his selections in it. ... The code as it stands does not actually print anything, it merely sets the VB Printer Object to the printer chosen in the dialog and transfers various user settings to it. ... Just to make sure we're both talking about the same thing, in your original post in this thread you said that you wanted to convert your printing from the CommonDialog to the API. ...
    (microsoft.public.vb.general.discussion)