From: Metroickha on
Hello all,

I have a question about exporting functions in a driver.
I did some exporting functions in other projects by using
__declspec(dllexport) but using that in a printer driver it fails to build.

I used data_seg(shared) to share data between processes using this DLL. How
ever I want to retrieve this data. I still haven't figured out how to do
this. I thought using properties (get /set) would make it possible.

Could anyone help me ^^?
From: Maxim S. Shatskih on
> __declspec(dllexport)

This is a dirty toy unsuitable for real projects, since it exports the functions with mangled names.

Use the proper way, i.e. .DEF file.

> I used data_seg(shared) to share data between processes using this DLL.

Amazingly bad solution. Can you use some sort of interprocess communication instead? why do you need this global data in a printer driver anyway?

--
Maxim S. Shatskih
Windows DDK MVP
maxim(a)storagecraft.com
http://www.storagecraft.com

From: Metroickha on
Thanks for your reply.

For an internship project I need to hook functions from the WIN32 GDI. I
used an existing sample MSPlot, which has the functionalities I need. I need
to hook for example CDC.LineTo() function using DrvLineTo() which stores all
parameters to shared memory block.

Example in my application

CDC dc;
dc.createDC("HP", "Plottername etc...", 0, 0);
dc.MoveTo(0,0);
dc.LineTo(10, 10);

The driver catches LineTo(...)
and stores it in the memory
For example
LineTo
10
10

From one other application we want to enter this shared memory block to
retrieve the instructions. I need to build this driver for a realtime system.
Storing in a bin file would be too slow.

The used tenchiques might be bad, but this is how my stakeholder wants me to
do it.

If it's possible to make some systemwide variabele would be even more
awesome ^^.

"Maxim S. Shatskih" wrote:

> > __declspec(dllexport)
>
> This is a dirty toy unsuitable for real projects, since it exports the functions with mangled names.
>
> Use the proper way, i.e. .DEF file.
>
> > I used data_seg(shared) to share data between processes using this DLL.
>
> Amazingly bad solution. Can you use some sort of interprocess communication instead? why do you need this global data in a printer driver anyway?
>
> --
> Maxim S. Shatskih
> Windows DDK MVP
> maxim(a)storagecraft.com
> http://www.storagecraft.com
>
> .
>
From: Alexander Grigoriev on
Also, the global data is logon session-local.

"Maxim S. Shatskih" <maxim(a)storagecraft.com.no.spam> wrote in message
news:%23q5VDOdwKHA.4492(a)TK2MSFTNGP05.phx.gbl...
> __declspec(dllexport)

This is a dirty toy unsuitable for real projects, since it exports the
functions with mangled names.

Use the proper way, i.e. .DEF file.

> I used data_seg(shared) to share data between processes using this DLL.

Amazingly bad solution. Can you use some sort of interprocess communication
instead? why do you need this global data in a printer driver anyway?

--
Maxim S. Shatskih
Windows DDK MVP
maxim(a)storagecraft.com
http://www.storagecraft.com


From: Eugene Mayevski on
> The used tenchiques might be bad, but this is how my stakeholder wants me
> to
> do it.
> If it's possible to make some systemwide variabele would be even more
> awesome ^^.

This is done using memory-mapped files. Quickly and efficiently. read about
CreateFileMapping / MapViewOfFile WinAPI functions. Note, that you will also
need to dig deeper into description of SecurityAttributes parameter of
CreateFileMapping. The reason is that default value (passing NULL) will have
certain limitations in Vista and Windows 7. You will need to create special
kind of attributes record with "Allow full access for everyone" set.

--
With best regards,
Eugene Mayevski
http://www.eldos.com/ - security and virtual storage components