bitmap Printer Driver help in window 98

Hi all

As in per prev post, I am able to download the 98ddk & ms vc 1.52 from microsoft. (i havent installed SDK.)

After trying a lot on making build comand to run…and finally able to make CBITMAP.DRV…which give bottom up bmp image…no issue here…though tried to make it top-down, but mspaint(in 98) shows error that bmp has pixels more on one side…

Problem

  • I tried calling CreateMutex/CloseHandle() (to check named mutex) from minidriv.c(of cbitmap.drv) and initially it gave some comiple time error, then i have got .obj files for all .c/asm files…but LINKER gave me error L2029 unresolved externals…i m quiet sure that Problems with LIB PATH here…am i right? Then why call with above apis work?..i can see kernel.lib in lib/win98/, …

C:\98DDK\src\printer\cbitmap>build -cZ
BUILD: Compile and Link for i386
BUILD: Compiling c:\98ddk\src\printer\cbitmap directory
Assembling - libinit.asm for i386
Compiling - minidriv.asm for i386
Compiling - cbitmap.asm for i386
Linking Executable - obj\i386\cbitmap.exe for i386
obj\i386\minidriv.obj(minidriv.c) : error L2029: ‘CREATEMUTEXA’ : unresolved ext
ernal
obj\i386\minidriv.obj(minidriv.c) : error L2029: ‘CLOSEHANDLE’ : unresolved exte
rnal
rc() : error RW1030: obj\i386\CBITMAP.exe: Errors occurred when linking file.
BUILD: Linking c:\98ddk\src\printer\cbitmap directory
BUILD: Done

3 files compiled - 2 Warnings
1 executables built - 1 Warnings - 3 Errors

  • i also tried to load DLLs from it, but loadlibrary failed. is it becoz of dll might be 32bit? so how to call such dll?
  • I also tried to import kernel.loadlibraryex32W/A… then linker gave another error (which i thoght will be easy to solve but couldnt :-()

C:\98DDK\src\printer\cbitmap>build -cZ
BUILD: Compile and Link for i386
BUILD: Compiling c:\98ddk\src\printer\cbitmap directory
Assembling - libinit.asm for i386
Compiling - minidriv.asm for i386
Compiling - cbitmap.asm for i386
Linking Executable - obj\i386\cbitmap.exe for i386
obj\i386\minidriv.obj(minidriv.c) : error L2003: near reference to far target at 229 in segment _TEXT
rc() : error RW1030: obj\i386\CBITMAP.exe: Errors occurred when linking file.
BUILD: Linking c:\98ddk\src\printer\cbitmap directory
BUILD: Done

3 files compiled - 2 Warnings
1 executables built - 1 Warnings - 2 Errors

Where can i get information regarding API to use in DRV? …

  • i might needed to check registry as well…RegOpenKey/RegEnum…etc…

I am agin lost and having tuff time with win98 :frowning:

Thanks in advance.

jrc

Windows 9X/ME printer drivers are 16-bit Windows binaries. You cannot use 32-bit Windows API (eg CreateMutex, CloseHandle). You are going to need a REALLY old software development kit for Windows 3.1 to see what the available API look like. You are also going to need to understand the 16-bit segmented programming models to understand the linker errors regarding the terms “near” and “far”. You may also run into limitations in the 64K maximum addressability of most pointers (unless you understand the “huge” model and its usage).

Additionally, you need to understand that this is co-operative multi-tasking, not time-sliced as it is in 32-bit apps. There are no threads, for instance- no events, no mutexes, no semaphores, etc.

You can get to 32-bit API using thunks [which will involve Dlls), but to be realistic, they are going to make things even worse for you unless you are incredibly knowledgeable and adept at working in both of these environments. The biggest stumbling block once you get past the myriad address translation issues is that the 32-bit code is and will be multithreaded, and if you start using typical design techniques you are used to from the 32-bit world, you will occasionally and randomly re-enter the 16 bit code on a different thread than the one you left on, typically resulting in intermittent deadlocks that will make absolutely no sense to you at all.

I’ve worked on many projects in this space, and it is (IMO) a nightmare [one of many reasons I’m glad I no longer work in printer drivers].

Wrt the registry, again you have a limited subset of API available- all formats are strings, and there is no concept of Keyword-value pairs. The 16-bit accessible registry is basically the key structure with SZ_TEXT values in the default (null) value. I don’t recall at the moment if all the hives are accessible, although I believe they are.

I believe there may be a section in MSDN library on safe places to thunk in a printer driver for these environments [in the event you decide to investigate that route]. There used to be, anyway.

But almost anything involving 16-32 bit thunks comes with a lot of warnings of the type “do this at your own risk, we don’t recommend doing this”.

Thanks a lot to all.

I have avoided 32bit api, and now using 16bit api to perform my requierment.

Finally, i am now able to make that 16bit printer driver for windows 98 and ME. its working perfactly!!! Thanks to you all.

Regards,
jrc