Linker isnt able to resolve function TdiRegisterPnPHandlers()

Hi,
I have written a TDI driver which basically connects and makes calls to TCPIP.sys.
I want this driver to be able to make calls to TCPIP protocol driver at boot time. So specifying a boot start and giving a dependency on TCPIP i am able to start the driver. However I am not able to make connect calls to other hosts at boot time . Each time it returns with error “Destination host unreachable” . I figured that TCPIP may not be fully initialized at the time of making CONNECT request to it using TDI interfaces.
Now i am trying to ensure that TCPIP is up, and able to make connections by registering the TdiRegisterPnPHandlers function with appropriate callbacks. I assume the binding handler will be called with opcode “TDI_PNP_OP_NETREADY” when the TCP stack is up and running . Is there any other way to ensure that the TCP stack is up and able to make connections ??

Also while compiling the driver code, it gives me a linker error that unable to resolve TdiRegisterPnPHandlers. I have included the tdikrnl.h and have also included the tdi.lib in the sources file. Still the error persists.

The error is as below

F:\ProvisionNew\pronet\WIN_NBD_CLIENT\Tdi_client>bld
BUILD: Compile and Link for x86
BUILD: Loading k:\winddk\6001.18000\build.dat…
BUILD: Computing Include file dependencies:
BUILD: Start time: Tue Sep 16 17:43:29 2008
BUILD: Examining f:\provisionnew\pronet\win_nbd_client\tdi_client directory for
files to compile.
BUILD: Saving k:\winddk\6001.18000\build.dat…
BUILD: Compiling and Linking f:\provisionnew\pronet\win_nbd_client\tdi_client di
rectory
_NT_TARGET_VERSION SET TO WS03
Compiling - main.cpp
Linking Executable - objchk_wnet_x86\i386\tdiclient.sys
errors in directory f:\provisionnew\pronet\win_nbd_client\tdi_client
f:\provisionnew\pronet\win_nbd_client\tdi_client\main.obj : error LNK2019: unres
olved external symbol “long __stdcall TdiRegisterPnPHandlers(struct _TDI20_CLIEN
T_INTERFACE_INFO *,unsigned long,void * *)” (?TdiRegisterPnPHandlers@@YGJPAU_TDI
20_CLIENT_INTERFACE_INFO@@KPAPAX@Z) referenced in function “long __stdcall MyReg
isterPnPHandlers(void)” (?MyRegisterPnPHandlers@@YGJXZ)
f:\provisionnew\pronet\win_nbd_client\tdi_client\objchk_wnet_x86\i386\tdiclient.
sys : error LNK1120: 1 unresolved externals
BUILD: Finish time: Tue Sep 16 17:43:31 2008
BUILD: Done

3 files compiled
1 executable built - 2 Errors

My sources file is as below !!

TARGETNAME = TDIClient
TARGETPATH = obj
TARGETTYPE = DRIVER

TARGETLIB = K:\WINDDK\6001.18000\lib\wnet\i386\tdi.lib

SOURCES = main.cpp

The function that i am using the call is

NTSTATUS MyRegisterPnPHandlers()
{
HANDLE Handle = NULL;
TDI20_CLIENT_INTERFACE_INFO tinfo;
tinfo.ClientName = NULL;
tinfo.MajorTdiVersion = TDI_CURRENT_MAJOR_VERSION;
tinfo.MinorTdiVersion = TDI_CURRENT_MINOR_VERSION;
RtlInitUnicodeString(tinfo.ClientName,L"TDIClient");

tinfo.PnPPowerHandler = NULL;
tinfo.BindingHandler = BindCallback;
tinfo.AddAddressHandlerV2 = TDIAddAddressHandler;
tinfo.DelAddressHandlerV2 = TDIDelAddressHandler;

TdiRegisterPnPHandlers(&tinfo,sizeof(tinfo),&Handle);

return STATUS_SUCCESS;
}

I am new to driver development. Any help or suggestions are highly appreciated

Thanks in advance… :slight_smile:

Your source file has a .CPP extension, this forces CL.EXE to compile
your code as C++, not as C.
As a result, the function names are mangled.
The symbol your code wants to link with is:
?TdiRegisterPnPHandlers@@YGJPAU_TDI20_CLIENT_INTERFACE_INFO@@KPAPAX@Z
instead of simply _TdiRegisterPnPHandlers@12

By the way, you can dump symbols of tdi.lib like this:
\> dumpbin.exe /EXPORTS tdi.lib

To resolve the problem, you need to convince CL.EXE to compile your code
as C, not as C++.
Simply renaming main.cpp to main.c will do the trick.

Alexey

xxxxx@yahoo.com wrote:

Hi,
I have written a TDI driver which basically connects and makes calls to TCPIP.sys.
I want this driver to be able to make calls to TCPIP protocol driver at boot time. So specifying a boot start and giving a dependency on TCPIP i am able to start the driver. However I am not able to make connect calls to other hosts at boot time . Each time it returns with error “Destination host unreachable” . I figured that TCPIP may not be fully initialized at the time of making CONNECT request to it using TDI interfaces.
Now i am trying to ensure that TCPIP is up, and able to make connections by registering the TdiRegisterPnPHandlers function with appropriate callbacks. I assume the binding handler will be called with opcode “TDI_PNP_OP_NETREADY” when the TCP stack is up and running . Is there any other way to ensure that the TCP stack is up and able to make connections ??

Also while compiling the driver code, it gives me a linker error that unable to resolve TdiRegisterPnPHandlers. I have included the tdikrnl.h and have also included the tdi.lib in the sources file. Still the error persists.

The error is as below

F:\ProvisionNew\pronet\WIN_NBD_CLIENT\Tdi_client>bld
BUILD: Compile and Link for x86
BUILD: Loading k:\winddk\6001.18000\build.dat…
BUILD: Computing Include file dependencies:
BUILD: Start time: Tue Sep 16 17:43:29 2008
BUILD: Examining f:\provisionnew\pronet\win_nbd_client\tdi_client directory for
files to compile.
BUILD: Saving k:\winddk\6001.18000\build.dat…
BUILD: Compiling and Linking f:\provisionnew\pronet\win_nbd_client\tdi_client di
rectory
_NT_TARGET_VERSION SET TO WS03
Compiling - main.cpp
Linking Executable - objchk_wnet_x86\i386\tdiclient.sys
errors in directory f:\provisionnew\pronet\win_nbd_client\tdi_client
f:\provisionnew\pronet\win_nbd_client\tdi_client\main.obj : error LNK2019: unres
olved external symbol “long __stdcall TdiRegisterPnPHandlers(struct _TDI20_CLIEN
T_INTERFACE_INFO *,unsigned long,void * *)” (?TdiRegisterPnPHandlers@@YGJPAU_TDI
20_CLIENT_INTERFACE_INFO@@KPAPAX@Z) referenced in function “long __stdcall MyReg
isterPnPHandlers(void)” (?MyRegisterPnPHandlers@@YGJXZ)
f:\provisionnew\pronet\win_nbd_client\tdi_client\objchk_wnet_x86\i386\tdiclient.
sys : error LNK1120: 1 unresolved externals
BUILD: Finish time: Tue Sep 16 17:43:31 2008
BUILD: Done

3 files compiled
1 executable built - 2 Errors

My sources file is as below !!

TARGETNAME = TDIClient
TARGETPATH = obj
TARGETTYPE = DRIVER

TARGETLIB = K:\WINDDK\6001.18000\lib\wnet\i386\tdi.lib

SOURCES = main.cpp

The function that i am using the call is

NTSTATUS MyRegisterPnPHandlers()
{
HANDLE Handle = NULL;
TDI20_CLIENT_INTERFACE_INFO tinfo;
tinfo.ClientName = NULL;
tinfo.MajorTdiVersion = TDI_CURRENT_MAJOR_VERSION;
tinfo.MinorTdiVersion = TDI_CURRENT_MINOR_VERSION;
RtlInitUnicodeString(tinfo.ClientName,L"TDIClient");

tinfo.PnPPowerHandler = NULL;
tinfo.BindingHandler = BindCallback;
tinfo.AddAddressHandlerV2 = TDIAddAddressHandler;
tinfo.DelAddressHandlerV2 = TDIDelAddressHandler;

TdiRegisterPnPHandlers(&tinfo,sizeof(tinfo),&Handle);

return STATUS_SUCCESS;
}

I am new to driver development. Any help or suggestions are highly appreciated

Thanks in advance… :slight_smile:


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

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

You do not need to compile as C. You need to use extern “C” when you include
the tdi include files.

Bill Wandel

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com]
On Behalf Of Alexey Polonsky
Sent: Tuesday, September 16, 2008 9:19 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Linker isnt able to resolve function
TdiRegisterPnPHandlers()

Your source file has a .CPP extension, this forces CL.EXE to compile your
code as C++, not as C.
As a result, the function names are mangled.
The symbol your code wants to link with is:
?TdiRegisterPnPHandlers@@YGJPAU_TDI20_CLIENT_INTERFACE_INFO@@KPAPAX@Z
instead of simply _TdiRegisterPnPHandlers@12

By the way, you can dump symbols of tdi.lib like this:
\> dumpbin.exe /EXPORTS tdi.lib

To resolve the problem, you need to convince CL.EXE to compile your code as
C, not as C++.
Simply renaming main.cpp to main.c will do the trick.

Alexey

xxxxx@yahoo.com wrote:

Hi,
I have written a TDI driver which basically connects and makes calls to
TCPIP.sys.
I want this driver to be able to make calls to TCPIP protocol driver at
boot time. So specifying a boot start and giving a dependency on TCPIP i am
able to start the driver. However I am not able to make connect calls to
other hosts at boot time . Each time it returns with error “Destination host
unreachable” . I figured that TCPIP may not be fully initialized at the time
of making CONNECT request to it using TDI interfaces.
Now i am trying to ensure that TCPIP is up, and able to make connections
by registering the TdiRegisterPnPHandlers function with appropriate
callbacks. I assume the binding handler will be called with opcode
“TDI_PNP_OP_NETREADY” when the TCP stack is up and running . Is there any
other way to ensure that the TCP stack is up and able to make connections ??

Also while compiling the driver code, it gives me a linker error that
unable to resolve TdiRegisterPnPHandlers. I have included the tdikrnl.h and
have also included the tdi.lib in the sources file. Still the error
persists.

The error is as below

F:\ProvisionNew\pronet\WIN_NBD_CLIENT\Tdi_client>bld
BUILD: Compile and Link for x86
BUILD: Loading k:\winddk\6001.18000\build.dat…
BUILD: Computing Include file dependencies:
BUILD: Start time: Tue Sep 16 17:43:29 2008
BUILD: Examining f:\provisionnew\pronet\win_nbd_client\tdi_client
directory for files to compile.
BUILD: Saving k:\winddk\6001.18000\build.dat…
BUILD: Compiling and Linking
f:\provisionnew\pronet\win_nbd_client\tdi_client di rectory
_NT_TARGET_VERSION SET TO WS03 Compiling - main.cpp Linking Executable

  • objchk_wnet_x86\i386\tdiclient.sys
    errors in directory f:\provisionnew\pronet\win_nbd_client\tdi_client
    f:\provisionnew\pronet\win_nbd_client\tdi_client\main.obj : error
    LNK2019: unres olved external symbol “long __stdcall
    TdiRegisterPnPHandlers(struct _TDI20_CLIEN T_INTERFACE_INFO *,unsigned
    long,void * *)” (?TdiRegisterPnPHandlers@@YGJPAU_TDI
    20_CLIENT_INTERFACE_INFO@@KPAPAX@Z) referenced in function “long
    __stdcall MyReg isterPnPHandlers(void)”
    (?MyRegisterPnPHandlers@@YGJXZ)
    f:\provisionnew\pronet\win_nbd_client\tdi_client\objchk_wnet_x86\i386\tdicli
    ent.
    sys : error LNK1120: 1 unresolved externals
    BUILD: Finish time: Tue Sep 16 17:43:31 2008
    BUILD: Done

3 files compiled
1 executable built - 2 Errors

My sources file is as below !!

TARGETNAME = TDIClient
TARGETPATH = obj
TARGETTYPE = DRIVER

TARGETLIB = K:\WINDDK\6001.18000\lib\wnet\i386\tdi.lib

SOURCES = main.cpp

The function that i am using the call is

NTSTATUS MyRegisterPnPHandlers()
{
HANDLE Handle = NULL;
TDI20_CLIENT_INTERFACE_INFO tinfo;
tinfo.ClientName = NULL;
tinfo.MajorTdiVersion = TDI_CURRENT_MAJOR_VERSION;
tinfo.MinorTdiVersion = TDI_CURRENT_MINOR_VERSION;
RtlInitUnicodeString(tinfo.ClientName,L"TDIClient");

tinfo.PnPPowerHandler = NULL;
tinfo.BindingHandler = BindCallback;
tinfo.AddAddressHandlerV2 = TDIAddAddressHandler;
tinfo.DelAddressHandlerV2 = TDIDelAddressHandler;

TdiRegisterPnPHandlers(&tinfo,sizeof(tinfo),&Handle);

return STATUS_SUCCESS;
}

I am new to driver development. Any help or suggestions are highly
appreciated

Thanks in advance… :slight_smile:


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

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


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

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

… or placing your #include for system headers inside an extern “C” {}
block…

Good Luck,
Dave Cattley
Consulting Engineer
Systems Software Development

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Alexey Polonsky
Sent: Tuesday, September 16, 2008 9:19 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Linker isnt able to resolve function
TdiRegisterPnPHandlers()

Your source file has a .CPP extension, this forces CL.EXE to compile
your code as C++, not as C.
As a result, the function names are mangled.
The symbol your code wants to link with is:
?TdiRegisterPnPHandlers@@YGJPAU_TDI20_CLIENT_INTERFACE_INFO@@KPAPAX@Z
instead of simply _TdiRegisterPnPHandlers@12

By the way, you can dump symbols of tdi.lib like this:
\> dumpbin.exe /EXPORTS tdi.lib

To resolve the problem, you need to convince CL.EXE to compile your code
as C, not as C++.
Simply renaming main.cpp to main.c will do the trick.

Alexey

xxxxx@yahoo.com wrote:

Hi,
I have written a TDI driver which basically connects and makes calls to
TCPIP.sys.
I want this driver to be able to make calls to TCPIP protocol driver at
boot time. So specifying a boot start and giving a dependency on TCPIP i am
able to start the driver. However I am not able to make connect calls to
other hosts at boot time . Each time it returns with error “Destination host
unreachable” . I figured that TCPIP may not be fully initialized at the time
of making CONNECT request to it using TDI interfaces.
Now i am trying to ensure that TCPIP is up, and able to make connections
by registering the TdiRegisterPnPHandlers function with appropriate
callbacks. I assume the binding handler will be called with opcode
“TDI_PNP_OP_NETREADY” when the TCP stack is up and running . Is there any
other way to ensure that the TCP stack is up and able to make connections ??

Also while compiling the driver code, it gives me a linker error that
unable to resolve TdiRegisterPnPHandlers. I have included the tdikrnl.h and
have also included the tdi.lib in the sources file. Still the error
persists.

The error is as below

F:\ProvisionNew\pronet\WIN_NBD_CLIENT\Tdi_client>bld
BUILD: Compile and Link for x86
BUILD: Loading k:\winddk\6001.18000\build.dat…
BUILD: Computing Include file dependencies:
BUILD: Start time: Tue Sep 16 17:43:29 2008
BUILD: Examining f:\provisionnew\pronet\win_nbd_client\tdi_client
directory for
files to compile.
BUILD: Saving k:\winddk\6001.18000\build.dat…
BUILD: Compiling and Linking
f:\provisionnew\pronet\win_nbd_client\tdi_client di
rectory
_NT_TARGET_VERSION SET TO WS03
Compiling - main.cpp
Linking Executable - objchk_wnet_x86\i386\tdiclient.sys
errors in directory f:\provisionnew\pronet\win_nbd_client\tdi_client
f:\provisionnew\pronet\win_nbd_client\tdi_client\main.obj : error LNK2019:
unres
olved external symbol “long __stdcall TdiRegisterPnPHandlers(struct
_TDI20_CLIEN
T_INTERFACE_INFO *,unsigned long,void * *)”
(?TdiRegisterPnPHandlers@@YGJPAU_TDI
20_CLIENT_INTERFACE_INFO@@KPAPAX@Z) referenced in function “long __stdcall
MyReg
isterPnPHandlers(void)” (?MyRegisterPnPHandlers@@YGJXZ)

f:\provisionnew\pronet\win_nbd_client\tdi_client\objchk_wnet_x86\i386\tdicli
ent.

sys : error LNK1120: 1 unresolved externals
BUILD: Finish time: Tue Sep 16 17:43:31 2008
BUILD: Done

3 files compiled
1 executable built - 2 Errors

My sources file is as below !!

TARGETNAME = TDIClient
TARGETPATH = obj
TARGETTYPE = DRIVER

TARGETLIB = K:\WINDDK\6001.18000\lib\wnet\i386\tdi.lib

SOURCES = main.cpp

The function that i am using the call is

NTSTATUS MyRegisterPnPHandlers()
{
HANDLE Handle = NULL;
TDI20_CLIENT_INTERFACE_INFO tinfo;
tinfo.ClientName = NULL;
tinfo.MajorTdiVersion = TDI_CURRENT_MAJOR_VERSION;
tinfo.MinorTdiVersion = TDI_CURRENT_MINOR_VERSION;
RtlInitUnicodeString(tinfo.ClientName,L"TDIClient");

tinfo.PnPPowerHandler = NULL;
tinfo.BindingHandler = BindCallback;
tinfo.AddAddressHandlerV2 = TDIAddAddressHandler;
tinfo.DelAddressHandlerV2 = TDIDelAddressHandler;

TdiRegisterPnPHandlers(&tinfo,sizeof(tinfo),&Handle);

return STATUS_SUCCESS;
}

I am new to driver development. Any help or suggestions are highly
appreciated

Thanks in advance… :slight_smile:


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

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


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

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

Wrapping the prototypes, or the include of the header defining them in extern “C” {} is the canonical way to resolve this decorated name screwup where C++ code links to C code, by the way.

  • S

-----Original Message-----
From: Alexey Polonsky
Sent: Tuesday, September 16, 2008 08:22
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Linker isnt able to resolve function TdiRegisterPnPHandlers()

Your source file has a .CPP extension, this forces CL.EXE to compile
your code as C++, not as C.
As a result, the function names are mangled.
The symbol your code wants to link with is:
?TdiRegisterPnPHandlers@@YGJPAU_TDI20_CLIENT_INTERFACE_INFO@@KPAPAX@Z
instead of simply _TdiRegisterPnPHandlers@12

By the way, you can dump symbols of tdi.lib like this:
> dumpbin.exe /EXPORTS tdi.lib

To resolve the problem, you need to convince CL.EXE to compile your code
as C, not as C++.
Simply renaming main.cpp to main.c will do the trick.

Alexey

xxxxx@yahoo.com wrote:
> Hi,
> I have written a TDI driver which basically connects and makes calls to TCPIP.sys.
> I want this driver to be able to make calls to TCPIP protocol driver at boot time. So specifying a boot start and giving a dependency on TCPIP i am able to start the driver. However I am not able to make connect calls to other hosts at boot time . Each time it returns with error “Destination host unreachable” . I figured that TCPIP may not be fully initialized at the time of making CONNECT request to it using TDI interfaces.
> Now i am trying to ensure that TCPIP is up, and able to make connections by registering the TdiRegisterPnPHandlers function with appropriate callbacks. I assume the binding handler will be called with opcode “TDI_PNP_OP_NETREADY” when the TCP stack is up and running . Is there any other way to ensure that the TCP stack is up and able to make connections ??
>
> Also while compiling the driver code, it gives me a linker error that unable to resolve TdiRegisterPnPHandlers. I have included the tdikrnl.h and have also included the tdi.lib in the sources file. Still the error persists.
>
> The error is as below
>
> F:\ProvisionNew\pronet\WIN_NBD_CLIENT\Tdi_client>bld
> BUILD: Compile and Link for x86
> BUILD: Loading k:\winddk\6001.18000\build.dat…
> BUILD: Computing Include file dependencies:
> BUILD: Start time: Tue Sep 16 17:43:29 2008
> BUILD: Examining f:\provisionnew\pronet\win_nbd_client\tdi_client directory for
> files to compile.
> BUILD: Saving k:\winddk\6001.18000\build.dat…
> BUILD: Compiling and Linking f:\provisionnew\pronet\win_nbd_client\tdi_client di
> rectory
> _NT_TARGET_VERSION SET TO WS03
> Compiling - main.cpp
> Linking Executable - objchk_wnet_x86\i386\tdiclient.sys
> errors in directory f:\provisionnew\pronet\win_nbd_client\tdi_client
> f:\provisionnew\pronet\win_nbd_client\tdi_client\main.obj : error LNK2019: unres
> olved external symbol “long __stdcall TdiRegisterPnPHandlers(struct _TDI20_CLIEN
> T_INTERFACE_INFO *,unsigned long,void * *)” (?TdiRegisterPnPHandlers@@YGJPAU_TDI
> 20_CLIENT_INTERFACE_INFO@@KPAPAX@Z) referenced in function “long__stdcall MyReg
> isterPnPHandlers(void)” (?MyRegisterPnPHandlers@@YGJXZ)
> f:\provisionnew\pronet\win_nbd_client\tdi_client\objchk_wnet_x86\i386\tdiclient.
> sys : error LNK1120: 1 unresolved externals
> BUILD: Finish time: Tue Sep 16 17:43:31 2008
> BUILD: Done
>
> 3 files compiled
> 1 executable built - 2 Errors
>
>
> My sources file is as below !!
>
> TARGETNAME = TDIClient
> TARGETPATH = obj
> TARGETTYPE = DRIVER
>
> TARGETLIB = K:\WINDDK\6001.18000\lib\wnet\i386\tdi.lib
>
>
> SOURCES = main.cpp
>
> The function that i am using the call is
>
> NTSTATUS MyRegisterPnPHandlers()
> {
> HANDLE Handle = NULL;
> TDI20_CLIENT_INTERFACE_INFO tinfo;
> tinfo.ClientName = NULL;
> tinfo.MajorTdiVersion = TDI_CURRENT_MAJOR_VERSION;
> tinfo.MinorTdiVersion = TDI_CURRENT_MINOR_VERSION;
> RtlInitUnicodeString(tinfo.ClientName,L"TDIClient");
>
> tinfo.PnPPowerHandler = NULL;
> tinfo.BindingHandler = BindCallback;
> tinfo.AddAddressHandlerV2 = TDIAddAddressHandler;
> tinfo.DelAddressHandlerV2 = TDIDelAddressHandler;
>
> TdiRegisterPnPHandlers(&tinfo,sizeof(tinfo),&Handle);
>
> return STATUS_SUCCESS;
> }
>
> I am new to driver development. Any help or suggestions are highly appreciated
>
> Thanks in advance… :slight_smile:
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer
>
>
>


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

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

Hi Imtiaz,

Although you make a successful compilation of this code using extern C or
something else, I think your main problem wont get solved.

The reason is, in a similar problem we are facing same kind of problem and
when we configured of system (which has our boottime network driver
installed) with static IP, the same code just worked completely fine. It a
proof that tcpip stack is up at the boot time (of course after few settings
in registry). The main problem is that dhcp is not up at boot time and you
are not able to get an IP when u wish to make TDI calls.

You need to figure out some way by which your system gets IP before you want
to do TDI calls.

Does anybody think that writing a DHCP client kinda code in driver entry
(before making TDI calls) can solve the problem? coz dhcp is a user mode
service and i dont think we could make it start at boot time before tdi
client driver.

  • Charan

On Wed, Sep 17, 2008 at 6:57 AM, Skywing wrote:

> Wrapping the prototypes, or the include of the header defining them in
> extern “C” {} is the canonical way to resolve this decorated name screwup
> where C++ code links to C code, by the way.
>
> - S
>
> -----Original Message-----
> From: Alexey Polonsky
> Sent: Tuesday, September 16, 2008 08:22
> To: Windows System Software Devs Interest List
> Subject: Re: [ntdev] Linker isnt able to resolve function
> TdiRegisterPnPHandlers()
>
>
> Your source file has a .CPP extension, this forces CL.EXE to compile
> your code as C++, not as C.
> As a result, the function names are mangled.
> The symbol your code wants to link with is:
> ?TdiRegisterPnPHandlers@@YGJPAU_TDI20_CLIENT_INTERFACE_INFO@@KPAPAX@Z
> instead of simply _TdiRegisterPnPHandlers@12
>
> By the way, you can dump symbols of tdi.lib like this:
> > dumpbin.exe /EXPORTS tdi.lib
>
> To resolve the problem, you need to convince CL.EXE to compile your code
> as C, not as C++.
> Simply renaming main.cpp to main.c will do the trick.
>
> Alexey
>
> xxxxx@yahoo.com wrote:
> > Hi,
> > I have written a TDI driver which basically connects and makes calls to
> TCPIP.sys.
> > I want this driver to be able to make calls to TCPIP protocol driver at
> boot time. So specifying a boot start and giving a dependency on TCPIP i am
> able to start the driver. However I am not able to make connect calls to
> other hosts at boot time . Each time it returns with error “Destination host
> unreachable” . I figured that TCPIP may not be fully initialized at the time
> of making CONNECT request to it using TDI interfaces.
> > Now i am trying to ensure that TCPIP is up, and able to make connections
> by registering the TdiRegisterPnPHandlers function with appropriate
> callbacks. I assume the binding handler will be called with opcode
> “TDI_PNP_OP_NETREADY” when the TCP stack is up and running . Is there any
> other way to ensure that the TCP stack is up and able to make connections ??
> >
> > Also while compiling the driver code, it gives me a linker error that
> unable to resolve TdiRegisterPnPHandlers. I have included the tdikrnl.h and
> have also included the tdi.lib in the sources file. Still the error
> persists.
> >
> > The error is as below
> >
> > F:\ProvisionNew\pronet\WIN_NBD_CLIENT\Tdi_client>bld
> > BUILD: Compile and Link for x86
> > BUILD: Loading k:\winddk\6001.18000\build.dat…
> > BUILD: Computing Include file dependencies:
> > BUILD: Start time: Tue Sep 16 17:43:29 2008
> > BUILD: Examining f:\provisionnew\pronet\win_nbd_client\tdi_client
> directory for
> > files to compile.
> > BUILD: Saving k:\winddk\6001.18000\build.dat…
> > BUILD: Compiling and Linking
> f:\provisionnew\pronet\win_nbd_client\tdi_client di
> > rectory
> > _NT_TARGET_VERSION SET TO WS03
> > Compiling - main.cpp
> > Linking Executable - objchk_wnet_x86\i386\tdiclient.sys
> > errors in directory f:\provisionnew\pronet\win_nbd_client\tdi_client
> > f:\provisionnew\pronet\win_nbd_client\tdi_client\main.obj : error
> LNK2019: unres
> > olved external symbol “long __stdcall TdiRegisterPnPHandlers(struct
> _TDI20_CLIEN
> > T_INTERFACE_INFO *,unsigned long,void * *)” (?TdiRegisterPnPHandlers@
> @YGJPAU_TDI
> > 20_CLIENT_INTERFACE_INFO@@KPAPAX@Z) referenced in function “long
>__stdcall MyReg
> > isterPnPHandlers(void)” (?MyRegisterPnPHandlers@@YGJXZ)
> >
> f:\provisionnew\pronet\win_nbd_client\tdi_client\objchk_wnet_x86\i386\tdiclient.
> > sys : error LNK1120: 1 unresolved externals
> > BUILD: Finish time: Tue Sep 16 17:43:31 2008
> > BUILD: Done
> >
> > 3 files compiled
> > 1 executable built - 2 Errors
> >
> >
> > My sources file is as below !!
> >
> > TARGETNAME = TDIClient
> > TARGETPATH = obj
> > TARGETTYPE = DRIVER
> >
> > TARGETLIB = K:\WINDDK\6001.18000\lib\wnet\i386\tdi.lib
> >
> >
> > SOURCES = main.cpp
> >
> > The function that i am using the call is
> >
> > NTSTATUS MyRegisterPnPHandlers()
> > {
> > HANDLE Handle = NULL;
> > TDI20_CLIENT_INTERFACE_INFO tinfo;
> > tinfo.ClientName = NULL;
> > tinfo.MajorTdiVersion = TDI_CURRENT_MAJOR_VERSION;
> > tinfo.MinorTdiVersion = TDI_CURRENT_MINOR_VERSION;
> > RtlInitUnicodeString(tinfo.ClientName,L"TDIClient");
> >
> > tinfo.PnPPowerHandler = NULL;
> > tinfo.BindingHandler = BindCallback;
> > tinfo.AddAddressHandlerV2 = TDIAddAddressHandler;
> > tinfo.DelAddressHandlerV2 = TDIDelAddressHandler;
> >
> > TdiRegisterPnPHandlers(&tinfo,sizeof(tinfo),&Handle);
> >
> > return STATUS_SUCCESS;
> > }
> >
> > I am new to driver development. Any help or suggestions are highly
> appreciated
> >
> > Thanks in advance… :slight_smile:
> >
> > —
> > NTDEV is sponsored by OSR
> >
> > For our schedule of WDF, WDM, debugging and other seminars visit:
> > http://www.osr.com/seminars
> >
> > To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
> >
> >
> >
>
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>

Charansing Rajput wrote:

Does anybody think that writing a DHCP client kinda code in driver entry
(before making TDI calls) can solve the problem? coz dhcp is a user mode
service and i dont think we could make it start at boot time before tdi
client driver.

Your own dhcp client is feasible (at least, for certain specific
configuration. been there, done that).
But this should be coupled with doing your own address translation,
because the ip stack has not sent a dhcp request yet, or how you
persuade it to use the new ip address?

–PA

Thanks a lot for the help guys !! The code compiles and links fine now !! But i am still stuck with the other part of my problem. Anythin about the TCPIP stack pblm ???