Results 1 to 5 of 5

Thread: System Driver Linking

  1. #1
    kolina
    Guest

    System Driver Linking

    Hi everybody,

    I tried to compile the UCL HASP Emulator for a valid HaspNT.sys. But my problem is how to link the .obj files correctly. With the DDK I can compile the .cpp files and with TASM the .asm files, but I can't figure out the correct switches for link to get them together. Always some entry point error or something else. Any help would be greatly appreciated! I'd also like to try out CrackZ HASP Driver Pack, but his download is suspended at the moment. Maybe somebody else can give me a link or send the file?

    Thank you very much for your help!
    --kolina
    I promise that I have read the FAQ and tried to use the Search to answer my question.

  2. #2
    Mostek
    Guest
    1st if you are using borland then there is a utility that will convert exe(if I remember right) to sys->I forgot the name of the utility but I know there is one as I had the same problem.

    2nd I know that everybody is used to his tools, but I would recomend you to start using M$ Visual C/C++ and MASM.
    Why?
    Most of the examples and documentation solutions references VC directly->so you don't have to read/search on how borland solve this problem.

    Sum: Borland is nice and I still use it sometimes, but for programming drivers (for win machines) the best solution is to go with M$ stuff.
    I didn't want to use M$ stuff at the begining also, but found that it works quite nice.

    Just a notice: If you'll install 'VisualStudio Net' be carefull not to uncheck to much stuff from installation options, as you will land into problems->the best is to leave everything what is already checked and maybe check even something extra that you need.

    I hope this helped.

    Peace
    Mostek
    I promise that I have read the FAQ and tried to use the Search to answer my question.

  3. #3
    kolina
    Guest

    Wink Linking

    Thanks Mostek! Normally I hate Borland, but in this case the source is for Turbo Assembler and can't be compiled with Masm. In the meantime I even managed to link all the OBJ files together (cpp compiled with VC XP DDK, asm files with TASM) with the following linker switches if I remember right:
    link *.obj (some lib) /driver /subsystem:native /entry:DriverEntry /out:HaspNT.sys
    And the driver is linked, but then I get a blue screen when running it. As I didn't change the source files at all I think it's a matter of the link switches.
    Any hints???
    Thanks!
    I promise that I have read the FAQ and tried to use the Search to answer my question.

  4. #4
    Mostek
    Guest
    Sorry non what so ever.

    Use SIce and debug->so you'll see what is wrong->maybe that will give you a hint.

    Peace
    Mostek
    I promise that I have read the FAQ and tried to use the Search to answer my question.

  5. #5
    g_g
    Guest
    There are several checks performed by the operating system (my memory is rusty at best, so i'll skip attempting to specify wich - you can debug the loading process, if you wan't this info) before a driver can be loaded.

    Once loaded, there are certain rules wich must be followed, mainly regarding the memory attributes of the various sections of the driver image. Certain functions must be located in non-pageable sections, as paging won't be possible when the functions are called.

    Obviously, none of the above is really going to help you with your problem, sorry, but that's as specific i can get without reading up on the subject.

    Here's the link argument's i've used when building masm based drivers:

    link /STACK:0x40000,0x1000 /MERGE:_PAGE=PAGE /MERGE:_TEXT=.text /MERGE:.rdata=INIT /SECTION:INIT,d /DRIVER /ALIGN:0x20 /SUBSYSTEM:NATIVE /BASE:0x10000 /LIBPATH:[ddk libpath] [object files] /OUT:[driver binary]

    the /merge arguments will most likely have to be changed to reflect the section names of your object files.

    Hope you'll be able to dig out a solution to your problem.
    I promise that I have read the FAQ and tried to use the Search to answer my question.

Similar Threads

  1. Operating System information
    By rijnahts in forum Advanced Reversing and Programming
    Replies: 1
    Last Post: September 12th, 2008, 14:43
  2. Linking .res using Borland C++
    By toolmanx in forum The Newbie Forum
    Replies: 8
    Last Post: May 8th, 2007, 09:28
  3. Linking the world
    By Devine9 in forum Off Topic
    Replies: 0
    Last Post: February 15th, 2003, 00:01

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •