Convert registry REG_BINARY DriverDate to PB Date?

Windows specific forum
techjunkie
Addict
Addict
Posts: 1126
Joined: Wed Oct 15, 2003 12:40 am
Location: Sweden
Contact:

Convert registry REG_BINARY DriverDate to PB Date?

Post by techjunkie »

Hi!

I have looked at MSDN but can't find an explanation for the

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Environments\Windows NT x86\Drivers\Version-[x]\[Printer Driver Name]\DriverDate

REG_BINARY format.

Does anyone know how this can be converted to PB Date Format?

Cheers!
Image
(\__/)
(='.'=) This is Bunny. Copy and paste Bunny into your
(")_(") signature to help him gain world domination.
Sparkie
PureBatMan Forever
PureBatMan Forever
Posts: 2307
Joined: Tue Feb 10, 2004 3:07 am
Location: Ohio, USA

Post by Sparkie »

Assume the variable regValue holds the value you received from the registry.

Code: Select all

fTime.FILETIME
sTime.SYSTEMTIME

; --> Here's the REG_BINARY value for my printer driver date
;     as it appears in my registry   00 c0 9f eb c5 28 c4 01
;     The result should be 2004.04.23

dtLow = $EB9FC000
dtHigh = $01C428C5

;     Comment out the previous 2 lines and uncomment the next
;     2 lines to use the REB_BINARY value you receive from your
;     RegQueryValueEx_() where regValue holds the binary date data.

;dtLow = PeekL(@regValue)
;dtHigh = PeekL(@regValue+4)

fTime\dwLowDateTime = dtLow
fTime\dwHighDateTime = dtHigh
FileTimeToSystemTime_(fTime, @sTime)
pbDate = Date(sTime\wYear, sTime\wMonth, sTime\wDay, sTime\wHour, sTime\wMinute, sTime\wSecond)
pbDate$ = FormatDate("%yyyy.%mm.%dd", pbDate)
MessageRequester("Binary date converted", pbDate$)
End
What goes around comes around.

PB 5.21 LTS (x86) - Windows 8.1
techjunkie
Addict
Addict
Posts: 1126
Joined: Wed Oct 15, 2003 12:40 am
Location: Sweden
Contact:

Post by techjunkie »

Sparkie wrote:Assume the variable regValue holds the value you received from the registry.
Thanks a lot Sparkie!! :D

A handy routine to have in the library... :!:

Thanks again!
Image
(\__/)
(='.'=) This is Bunny. Copy and paste Bunny into your
(")_(") signature to help him gain world domination.
techjunkie
Addict
Addict
Posts: 1126
Joined: Wed Oct 15, 2003 12:40 am
Location: Sweden
Contact:

Post by techjunkie »

Hmmm... Is it possible to do the same with,

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Environments\Windows NT x86\Drivers\Version-[x]\[Printer Driver Name]\DriverVersion

Can't find any Interface for "Version Info".
Image
(\__/)
(='.'=) This is Bunny. Copy and paste Bunny into your
(")_(") signature to help him gain world domination.
Sparkie
PureBatMan Forever
PureBatMan Forever
Posts: 2307
Joined: Tue Feb 10, 2004 3:07 am
Location: Ohio, USA

Post by Sparkie »

See if this works for you. It's all guesswork but it returns the correct info for my driver version. ;)

Code: Select all

verMajor = PeekW(@regBinaryValue+6)
verMinor = PeekW(@regBinaryValue+4)
verRev =  PeekW(@regBinaryValue+2)
verBuild = PeekW(@regBinaryValue)
ver$ = Str(verMajor) + "." + Str(verMinor) + "." + Str(verRev) + "." + Str(verBuild)
MessageRequester("DriverVersion", ver$)
What goes around comes around.

PB 5.21 LTS (x86) - Windows 8.1
techjunkie
Addict
Addict
Posts: 1126
Joined: Wed Oct 15, 2003 12:40 am
Location: Sweden
Contact:

Post by techjunkie »

Sparkie! If you ever visit Sweden or Denmark, I'll buy you a beer or two... :D

You are a real Windows Guru! Thanks!!!!
Image
(\__/)
(='.'=) This is Bunny. Copy and paste Bunny into your
(")_(") signature to help him gain world domination.
Sparkie
PureBatMan Forever
PureBatMan Forever
Posts: 2307
Joined: Tue Feb 10, 2004 3:07 am
Location: Ohio, USA

Post by Sparkie »

You're welcome techjunkie, and thank you for the kind words...

and for the offer to pay my way over to Sweden (I don't mind flying coach)...

and for promising to buy me a brewery of my very own (You'll be hired as my senior taste tester). 8) :P :wink: :)
What goes around comes around.

PB 5.21 LTS (x86) - Windows 8.1
Post Reply