Re: Version number for nk.bin

From: Ten (spam_at_spam.com)
Date: 04/02/04


Date: Fri, 2 Apr 2004 09:01:36 -0500

For the read only registry entry, you could automate this as a custom build
step associated with the BSP or one of the other components in the platform.
The custom build step could be invoking a script or exe to do some work on
one of the .reg files included in the platform or on reginit.ini itself
before nk.bin is created.

If you really wanted to obfuscate the issue you could do something like
this:

Write a simple stream interface driver. This is a DLL. Add it to the
project.bib. At an appropriate time in your application or whatever, call
ActivateDevice(Ex) and load the driver. Once it is loaded, use the standard
stream interface APIs (CreateFile, ReadFile, DeviceIoControl, CloseHandle,
etc). When you are done, call DeactiveDevice to unload the driver.

Since you write the stream interface DLL you control what APIs it responds
to. So, for example, you can implement XXX_Read or XXX_IoControl to get the
version. Name the DLL something that sounds important like nkhelper.dll so
a nosey user won't, at a glance, discern what it is.

You can hard code a value into the driver or, when the driver is built, have
a custom build step associated with it that updates the version number in a
resource file (again a script or exe). Another thing to do would be to add
a post build step to the custom build for the driver that would delete all
the obj files for the driver. This will force the driver to be
automatically rebuilt the next time the platform is built.

The sequence to access the version information programatically would be
something like this:

GetVersion()
{
hDev = ActivateDevice(x,y);
hInst = CreateFile("XXX1:",...,);
DeviceIoControl(hInst, GET_VERSION, &value, &size, ...., )
CloseHandle(hInst)
DeactivateDevice(hDev)
return value
}

Nick.

"kuoney" <ku2y@hotmail.com> wrote in message
news:3F98A7A6-7A69-4BB7-9AB4-8DC39FC9FEFD@microsoft.com...
> Hi,
> I need to associate every nk.bin I create with a unique version number. I
looked at several alternatives but couldn't find out what exactly is the
right way. First of all, I would really like it if I can find a solution
that updates this version number automatically when I do a "rebuild
platform" or a "build platform". It would equally be sweet if this version
number is accessible from an application through a standard API call. Even
if it doesn't and I can pass this number through an IOCTL from a driver,
that's OK too. Does anyone have any ideas? I thought in the worst case, I
could add a read-only registry entry and modify it before every build but
that just doesn't sound right (plus it's manual).
> Thanks a lot!



Relevant Pages