473,732 Members | 2,175 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Get last access date of desktop shortcut

yxq
Hello,
The XP Desktop clean wizard can get the last access time of desktop
shortcut, i found that the info come from

"HKEY_CURRENT_U SER\Software\Mi crosoft\Windows \CurrentVersion \Explorer\UserA ssist\{75048700-EF1F-11D0-9888-006097DEACF9}\C ount"

The valuename and value are encrypted using ROT13, the function below can
decrypt them

*************** *************** *************** *************** *
'Encodes text using the ROT13 algorithm
Public Function ROT13Encode(ByV al InputText As String) As String
Dim i As Integer
Dim CurrentCharacte r As Char
Dim CurrentCharacte rCode As Integer
Dim EncodedText As String = ""

'Iterate through the length of the input parameter
For i = 0 To InputText.Lengt h - 1
'Convert the current character to a char
CurrentCharacte r =
System.Convert. ToChar(InputTex t.Substring(i, 1))

'Get the character code of the current character
CurrentCharacte rCode =
Microsoft.Visua lBasic.Asc(Curr entCharacter)

'Modify the character code of the character, - this
'so that "a" becomes "n", "z" becomes "m", "N" becomes "Y"
and so on
If CurrentCharacte rCode >= 97 And CurrentCharacte rCode <=
109 Then
CurrentCharacte rCode = CurrentCharacte rCode + 13

Else
If CurrentCharacte rCode >= 110 And CurrentCharacte rCode
<= 122 Then
CurrentCharacte rCode = CurrentCharacte rCode - 13

Else
If CurrentCharacte rCode >= 65 And
CurrentCharacte rCode <= 77 Then
CurrentCharacte rCode = CurrentCharacte rCode + 13

Else
If CurrentCharacte rCode >= 78 And
CurrentCharacte rCode <= 90 Then
CurrentCharacte rCode =
CurrentCharacte rCode - 13
End If
End If
End If 'Add the current character to the string to be
returned
End If
EncodedText = EncodedText +
Microsoft.Visua lBasic.ChrW(Cur rentCharacterCo de)
Next i

Return EncodedText
End Function 'ROT13Encode
*************** *************** *************** **

The 16 byte Binary value will store the last access date and time, can
anyone know how to recover the bianry value to date?

Thank you

Nov 21 '05 #1
3 2008
Are you asking for a method of directly translating the binary stored valued
direct to a Datestring using the Framework with vb.net?

If you are I dont ever remember seeing this functionality anywhere. It is
highly likely though that if you search MSDN and find the Windows API, that
you will find an API that you can use in your code to simplify what you are
doing.

Someone else may have an alternative answer

OHM ( Terry Burns )

http://TrainingOn.net


"yxq" <ga***@163.ne t> wrote in message
news:uo******** ******@TK2MSFTN GP14.phx.gbl...
Hello,
The XP Desktop clean wizard can get the last access time of desktop
shortcut, i found that the info come from

"HKEY_CURRENT_U SER\Software\Mi crosoft\Windows \CurrentVersion \Explorer\UserA ssist\{75048700-EF1F-11D0-9888-006097DEACF9}\C ount"

The valuename and value are encrypted using ROT13, the function below can
decrypt them

*************** *************** *************** *************** *
'Encodes text using the ROT13 algorithm
Public Function ROT13Encode(ByV al InputText As String) As String
Dim i As Integer
Dim CurrentCharacte r As Char
Dim CurrentCharacte rCode As Integer
Dim EncodedText As String = ""

'Iterate through the length of the input parameter
For i = 0 To InputText.Lengt h - 1
'Convert the current character to a char
CurrentCharacte r =
System.Convert. ToChar(InputTex t.Substring(i, 1))

'Get the character code of the current character
CurrentCharacte rCode =
Microsoft.Visua lBasic.Asc(Curr entCharacter)

'Modify the character code of the character, - this
'so that "a" becomes "n", "z" becomes "m", "N" becomes "Y"
and so on
If CurrentCharacte rCode >= 97 And CurrentCharacte rCode <=
109 Then
CurrentCharacte rCode = CurrentCharacte rCode + 13

Else
If CurrentCharacte rCode >= 110 And CurrentCharacte rCode
<= 122 Then
CurrentCharacte rCode = CurrentCharacte rCode - 13

Else
If CurrentCharacte rCode >= 65 And
CurrentCharacte rCode <= 77 Then
CurrentCharacte rCode = CurrentCharacte rCode +
13

Else
If CurrentCharacte rCode >= 78 And
CurrentCharacte rCode <= 90 Then
CurrentCharacte rCode =
CurrentCharacte rCode - 13
End If
End If
End If 'Add the current character to the string to be
returned
End If
EncodedText = EncodedText +
Microsoft.Visua lBasic.ChrW(Cur rentCharacterCo de)
Next i

Return EncodedText
End Function 'ROT13Encode
*************** *************** *************** **

The 16 byte Binary value will store the last access date and time, can
anyone know how to recover the bianry value to date?

Thank you

Nov 21 '05 #2
>The 16 byte Binary value will store the last access date and time, can
anyone know how to recover the bianry value to date?


Looks like you should interpret the last 8 bytes as a FILETIME
structure.

Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Nov 21 '05 #3
yxq
Yes, it is a 8 bytes filetime structure.
I found a sample to get lastshutdowntim e, it will get the 8 bytes binary
value.
But it is VB6 and use the RegQueryValueEx function.

If i have 8 bytes binary value, how to convert it to date and time using
VB.Net?
I dont know the relation of 8 bytes and Date.

Thank you

Option Explicit
''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''''''' ''''
' Copyright ?1996-2005 VBnet, Randy Birch, All Rights Reserved.
' Some pages may also contain other copyrights by the author.
''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''''''' ''''
' Distribution: You can freely use this code in your own
' applications, but you may not reproduce
' or publish this code on any web site,
' online service, or distribute as source
' on any media without express permission.
''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''''''' ''''
Private Const MAX_COMPUTERNAM E As Long = 16
Private Const REG_BINARY As Long = &H3
Private Const HKEY_LOCAL_MACH INE = &H80000002
Private Const ERROR_SUCCESS As Long = 0
Private Const STANDARD_RIGHTS _READ As Long = &H20000
Private Const KEY_QUERY_VALUE As Long = &H1
Private Const KEY_ENUMERATE_S UB_KEYS As Long = &H8
Private Const KEY_NOTIFY As Long = &H10
Private Const SYNCHRONIZE As Long = &H100000
Private Const KEY_READ As Long = ((STANDARD_RIGH TS_READ Or _
KEY_QUERY_VALUE Or _
KEY_ENUMERATE_S UB_KEYS Or _
KEY_NOTIFY) And _
(Not SYNCHRONIZE))
Private Type SYSTEMTIME
wYear As Integer
wMonth As Integer
wDayOfWeek As Integer
wDay As Integer
wHour As Integer
wMinute As Integer
wSecond As Integer
wMilliseconds As Integer
End Type

Private Type FILETIME
dwLowDateTime As Long
dwHighDateTime As Long
End Type

Private Type TIME_ZONE_INFOR MATION
Bias As Long
StandardName(0 To 63) As Byte
StandardDate As SYSTEMTIME
StandardBias As Long
DaylightName(0 To 63) As Byte
DaylightDate As SYSTEMTIME
DaylightBias As Long
End Type
Private Declare Function GetTimeZoneInfo rmation Lib "kernel32" _
(lpTimeZoneInfo rmation As TIME_ZONE_INFOR MATION) As Long

Private Declare Function SystemTimeToTzS pecificLocalTim e Lib "kernel32" _
(lpTimeZone As TIME_ZONE_INFOR MATION, _
lpUniversalTime As SYSTEMTIME, _
lpLocalTime As SYSTEMTIME) As Long

Private Declare Function FileTimeToSyste mTime Lib "kernel32" _
(lpFileTime As FILETIME, _
lpSystemTime As SYSTEMTIME) As Long

Private Declare Function RegOpenKeyEx Lib "advapi32.d ll" _
Alias "RegOpenKey ExA" _
(ByVal hKey As Long, _
ByVal lpSubKey As String, _
ByVal ulOptions As Long, _
ByVal samDesired As Long, _
phkResult As Long) As Long

Private Declare Function RegQueryValueEx Lib "advapi32.d ll" _
Alias "RegQueryValueE xA" _
(ByVal hKey As Long, _
ByVal lpValueName As String, _
ByVal lpReserved As Long, _
lpType As Long, _
lpData As Any, _
lpcbData As Long) As Long

Private Declare Function RegCloseKey Lib "advapi32.d ll" _
(ByVal hKey As Long) As Long

Private Declare Function lstrlenW Lib "kernel32" _
(ByVal lpString As Long) As Long

Private Sub Form_Load()

Command1.Captio n = "Last Shutdown Date"
Check1.Caption = "Include time"
Text1.Text = ""

End Sub
Private Sub Command1_Click( )

Dim buff As String
Dim bIncludeTime As Boolean

bIncludeTime = Check1.Value = vbChecked
buff = GetLastSystemSh utdown(bInclude Time)
Text1.Text = buff

End Sub
Private Function GetLastSystemSh utdown(bInclude Time As Boolean) As String

Dim hKey As Long
Dim sKey As String
Dim sValueName As String
Dim ft As FILETIME 'value to retrieve
Dim cbData As Long 'size of data

sKey = "System\Current ControlSet\Cont rol\Windows"
sValueName = "ShutdownTi me"

If RegOpenKeyEx(HK EY_LOCAL_MACHIN E, _
sKey, _
0&, _
KEY_READ, _
hKey) = ERROR_SUCCESS Then

If hKey <> 0 Then

'retrieve the passed value if present
cbData = Len(ft)
If RegQueryValueEx (hKey, _
sValueName, _
0&, _
REG_BINARY, _
ft, _
cbData) = ERROR_SUCCESS Then

GetLastSystemSh utdown = GetFileToSystem Date(ft, bIncludeTime)

End If 'RegQueryValueE x

'clean-up
RegCloseKey hKey

End If 'hKey
End If 'RegOpenKeyEx

End Function
Private Function GetFileToSystem Date(ft As FILETIME, _
Optional bIncludeTime As Boolean =
False) As String

Dim buff As String
Dim st As SYSTEMTIME 'system (UNC) time
Dim lt As SYSTEMTIME 'local time
Dim tz As TIME_ZONE_INFOR MATION

If FileTimeToSyste mTime(ft, st) Then

'retrieve the local time zone info
GetTimeZoneInfo rmation tz

'convert the system time returned above
'to a local time taking the time zone
'info into account
SystemTimeToTzS pecificLocalTim e tz, st, lt

'now just write it out
buff = Format$(DateSer ial(lt.wYear, lt.wMonth, lt.wDay), "Long Date")

If bIncludeTime Then

buff = buff & " @ " & Format$(TimeSer ial(lt.wHour, _
lt.wMinute, _
lt.wSecond), _
"Long Time")
End If

GetFileToSystem Date = buff

Else
GetFileToSystem Date = ""
End If

End Function


"Mattias Sjögren" <ma************ ********@mvps.o rg> дÈëÏûÏ¢ÐÂÎÅ:uO **************@ tk2msftngp13.ph x.gbl...
The 16 byte Binary value will store the last access date and time, can
anyone know how to recover the bianry value to date?


Looks like you should interpret the last 8 bytes as a FILETIME
structure.

Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.

Nov 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
27026
by: Eskimo Joe | last post by:
I am trying to create a desktop icon using VB6. is this possible? -p
3
1697
by: icb | last post by:
Hi I have a front-end/back-end setup. The front-end utilises all unbound forms populating the back-end via the code I have written. All fine so far. Prior to splitting the database I ran the security wizard and used a shortcut from the desktop. All fine except of course I can open the back-end directly. The security FAQ appears to be out of date insofar as there is no wrkgadm.exe with 2002 and therefore you simply run the security...
1
1774
by: Farouq | last post by:
Hi all, I have database which the front end is installed on c:\database\sample.mdb and the backend on a server. The problem i am havin is wen i set the database for user such as joe blogs the database will work for them. But if another user logs on such as jenny blogs the database doesn't work. It says microsoft can't find the database file c:\database\sample.mdb. however if i replace
16
4880
by: Rob Geraghty | last post by:
I've just spent some time looking through FAQ sites and searching the google archives of this newsgroup, but I still haven't been able to find a clear explanation of an issue with multi-user databases. Essentially I have two questions; 1) Does the system.mdw file have any significance to multi-user sharing of an Access 97 database other than security? 2) Can any number of users open an Access 97 database using the same
7
31258
by: GrandpaB | last post by:
I would appreciate assistance learning how to create a Desktop shortcut in my setup project. In the left pane of the Setup/File System window I right-clicked User's Desktop. From the contex menu I clicked Create Shortcut to User's Desktop. In the right pane of the setup/File System window the object Shortcut to User's Desktop appeared. When I selected the object and checked it's properties the Target and WorkingFolder are User's...
0
2271
by: peter.bittner | last post by:
I have developed a Windows application in Visual Studio .NET 2003 and created a Setup project for it. In the File System Editor I have added a shortcut to the User's Desktop folder to point to the application once it has been installed. I have added a condition to the User's Desktop named "DESKTOPSHORTCUT" (I have used several names, this is just the latest). In the User interface, I have added a screen with a checkbox that asks the user...
5
13230
by: Linds | last post by:
I have a report within my access database that I would like to have a shortcut on my desktop that could bring up that report. In other words, now I have to double click on the database, then go into the reports module, then double click on the report. You can probably guess I am a newbie at access, so any push in the right direction would be greatly appreciated.
12
6394
by: ARC | last post by:
I'm currently looking at the access developer extensions for creating an MSI installer package for a 2007 runtime app. Couple of observations and questions. 1) Doesn't look like we have the ability to set a packaged file to always overwrite, or never overwrite, unless I'm missing something. This could be a sticking point, as I would always want the program to overwrite on re-installing, but NEVER the back end database. I have a few more...
3
1664
by: Jeff | last post by:
I need help in figuring out why a shortcut on a desktop to an access database times out and never opens. This occurs on one computer and not the rest.. I am able to open MSaccess and then the database from a peer to peer network share on the same computer. Using a shortcut doesn't work. In the properties of the shortcut on the desktop I can test to see if it finds the correct network share and file, which it does. In the Event...
0
9306
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9180
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6733
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6030
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4548
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4805
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3259
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2721
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2177
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.