How to compile a image into .sys?

I have 50K a image file, which is used by a driver abc.sys, but want to deliver only the sys file.
So can i compile it into .sys and how can i access it in driver?

Put it in your .rc file just like you do if the binary were a dll or exe, the resource syntax is exactly the same. The big difference is that in user mode there are APIs to read the resource section, parse it and give you the data back. In km you have to parse the PE header yourself and find the resource on your own.

Have you considered just including the image in binary format as a global array of bytes?

d

Sent from my phone with no t9, all spilling mistakes are not intentional.

-----Original Message-----
From: xxxxx@hotmail.com
Sent: Tuesday, October 13, 2009 7:05 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] How to compile a image into .sys?

I have 50K a image file, which is used by a driver abc.sys, but want to deliver only the sys file.
So can i compile it into .sys and how can i access it in driver?


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

I’d recommend the second option Doron mentioned as well. Binary parsing is not the friendliest of kernel activities.

This is probably not an option, but if you knew for certain that your sys would be installed on an NTFS drive, you could write an installer that stored the image as a name stream in your driver.

mm

I used to put it in a global byte array, in this case, i have to convert the binary image into a byte array C code. I am looking for a easy way.
Anyway, thank you very much.

I don’t know the name of one offhand, but there are lots of tools out there that convert things in to such an array for use in shell code.

Good luck,

mm

A short and simple C program can do the trick.

One consideration is that if you may ever need to swap the image file (don’t know what you will use it for) then you need to re-sign your whole driver package. Unless the image really won’t change, you may be inadvertently setting yourself up for a future maintenance headache.

  • S

-----Original Message-----
From: xxxxx@hotmail.com
Sent: Tuesday, October 13, 2009 19:41
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] How to compile a image into .sys?

I used to put it in a global byte array, in this case, i have to convert the binary image into a byte array C code. I am looking for a easy way.
Anyway, thank you very much.


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

That’s a an excellent point that I had not considered.

mm