|
ms
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
retrive bios clock date and timeI have been searching google all day trying to find a way to use win32
to retrive a computer's local time from the bios clocl, rather than the system time, in the event that someone changed the system date (accidentally or intentionally). I found the win32_currenttime, but using system.management classes with wmi this parameter returns a collection with a count of zero. msdn has information on the getsystemtime function, but says it is part of the Provider classes which are obsolete and recomments using system.management. Any one know how to do this? Bill Hi Bill,
I believe win32_currenttime is just an abstract class for win32_localtime and win32_localutctime. I'm not sure this is the bios time but you can read an instance of win32_localtime this way: using System.Management; .... ManagementClass mc = new ManagementClass("win32_localtime"); foreach (ManagementObject mo in mc.GetInstances()) { Console.WriteLine(mo.GetText(TextFormat.Mof)); } And you will get something like this: instance of Win32_LocalTime { Day = 14; DayOfWeek = 0; Hour = 13; Minute = 2; Month = 6; Quarter = 2; Second = 50; WeekInMonth = 3; Year = 2009; }; -- Show quoteHide quoteHappy Coding! Morten Wennevik [C# MVP] "Bill" wrote: > I have been searching google all day trying to find a way to use win32 > to retrive a computer's local time from the bios clocl, rather than > the system time, in the event that someone changed the system date > (accidentally or intentionally). > I found the win32_currenttime, but using system.management classes > with wmi this parameter returns a collection with a count of zero. > msdn has information on the getsystemtime function, but says it is > part of the Provider classes which are obsolete and recomments using > system.management. > > Any one know how to do this? > > Bill > Hi Morten,
well, IMHO there is no need to do that, since you are pretty good with DateTime,... And if you really need to access BIOS and need data from it, either you try the WMI Interfaces to satisfy your needs or your write a simple driver with IOCTL Dispatch to poll all data you need from systen hardware within your driver and write back to the buffers. There is no other way to query low-level system bios data without crossing the ring3->ring0 boundary,... But as said: DateTime is just fine,...even no need for Windows API,...! Regards Kerem -- Show quoteHide quote-- ----------------------- Beste Grüsse / Best regards / Votre bien devoue Kerem Gümrükcü Latest Project: http://www.pro-it-education.de/software/deviceremover Latest Open-Source Projects: http://entwicklung.junetz.de ----------------------- "This reply is provided as is, without warranty express or implied." "Morten Wennevik [C# MVP]" <MortenWenne***@hotmail.com> schrieb im Newsbeitrag news:4A5A7F58-4A1B-4025-89BD-6D34BEB816B8@microsoft.com... > Hi Bill, > > I believe win32_currenttime is just an abstract class for win32_localtime > and win32_localutctime. > > I'm not sure this is the bios time but you can read an instance of > win32_localtime this way: > > using System.Management; > > ... > > ManagementClass mc = new ManagementClass("win32_localtime"); > foreach (ManagementObject mo in mc.GetInstances()) > { > Console.WriteLine(mo.GetText(TextFormat.Mof)); > } > > And you will get something like this: > > instance of Win32_LocalTime > { > Day = 14; > DayOfWeek = 0; > Hour = 13; > Minute = 2; > Month = 6; > Quarter = 2; > Second = 50; > WeekInMonth = 3; > Year = 2009; > }; > -- > Happy Coding! > Morten Wennevik [C# MVP] > > > "Bill" wrote: > >> I have been searching google all day trying to find a way to use win32 >> to retrive a computer's local time from the bios clocl, rather than >> the system time, in the event that someone changed the system date >> (accidentally or intentionally). >> I found the win32_currenttime, but using system.management classes >> with wmi this parameter returns a collection with a count of zero. >> msdn has information on the getsystemtime function, but says it is >> part of the Provider classes which are obsolete and recomments using >> system.management. >> >> Any one know how to do this? >> >> Bill >> "Bill" <billsahi***@yahoo.com> wrote in message If anyone changes the system date, the hardware real-time clock gets changed news:92675db4-4996-4bdc-a9bc-bf688a17ed0e@k19g2000prh.googlegroups.com... > I have been searching google all day trying to find a way to use win32 > to retrive a computer's local time from the bios clocl, rather than > the system time, in the event that someone changed the system date > (accidentally or intentionally). too. Are you trying to get a date and time from a more reliable source that the computer owner? You can make a request across the web and use asymmetric encryption to verify that it came from the trusted source, but the computer owner can just change your program to skip the check. There really is no way to secure data being used in an untrusted environment -- MMORPG companies spend millions of dollars trying and still fail. Show quoteHide quote > I found the win32_currenttime, but using system.management classes __________ Information from ESET NOD32 Antivirus, version of virus signature database 4153 (20090613) __________> with wmi this parameter returns a collection with a count of zero. > msdn has information on the getsystemtime function, but says it is > part of the Provider classes which are obsolete and recomments using > system.management. > > Any one know how to do this? > > Bill > > __________ Information from ESET NOD32 Antivirus, version of virus > signature database 4153 (20090613) __________ > > The message was checked by ESET NOD32 Antivirus. > > http://www.eset.com > > > The message was checked by ESET NOD32 Antivirus. http://www.eset.com I confirmed what you say by getting the win32_localtime data. My only
other idea is to use the date of the windows swap file and compare it with the system date. If the system date is older, then I know it was modified by the user, but still does not get the real system date. My purpose, as you may have guessed, is for use in the trial version of software. Show quoteHide quote On Jun 14, 12:26 pm, "Ben Voigt [C++ MVP]" <bvo...@newsgroup.nospam> wrote: > "Bill" <billsahi***@yahoo.com> wrote in message > > news:92675db4-4996-4bdc-a9bc-bf688a17ed0e@k19g2000prh.googlegroups.com... > > > I have been searching google all day trying to find a way to use win32 > > to retrive a computer's local time from the bios clocl, rather than > > the system time, in the event that someone changed the system date > > (accidentally or intentionally). > > If anyone changes the system date, the hardware real-time clock gets changed > too. Are you trying to get a date and time from a more reliable source that > the computer owner? You can make a request across the web and use > asymmetric encryption to verify that it came from the trusted source, but > the computer owner can just change your program to skip the check. > > There really is no way to secure data being used in an untrusted > environment -- MMORPG companies spend millions of dollars trying and still > fail. > > > > > > > I found the win32_currenttime, but using system.management classes > > with wmi this parameter returns a collection with a count of zero. > > msdn has information on the getsystemtime function, but says it is > > part of the Provider classes which are obsolete and recomments using > > system.management. > > > Any one know how to do this? > > > Bill > > > __________ Information from ESET NOD32 Antivirus, version of virus > > signature database 4153 (20090613) __________ > > > The message was checked by ESET NOD32 Antivirus. > > >http://www.eset.com > > __________ Information from ESET NOD32 Antivirus, version of virus signature database 4153 (20090613) __________ > > The message was checked by ESET NOD32 Antivirus. > > http://www.eset.com- Hide quoted text - > > - Show quoted text - "Bill" <billsahi***@yahoo.com> wrote in message Ok, I suppose you want to protect your software against torrent users but news:a2445a3e-0293-4d19-b6a4-a5af1eaf6064@d7g2000prl.googlegroups.com... > I confirmed what you say by getting the win32_localtime data. My only > other idea is to use the date of the windows swap file and compare it > with the system date. If the system date is older, then I know it was > modified by the user, but still does not get the real system date. My > purpose, as you may have guessed, is for use in the trial version of > software. not against the three real hackers in the world who will bypass the trial check, putting in the effort to get those last three users to pay for their licenses just isn't worth it. So implement a "check for updates at startup" feature, and if a trial user tries to disable it politely inform them that doing so requires the paid version. Then you'll get a reliable timestamp served up by your own web host. Show quoteHide quote > > On Jun 14, 12:26 pm, "Ben Voigt [C++ MVP]" <bvo...@newsgroup.nospam> > wrote: >> "Bill" <billsahi***@yahoo.com> wrote in message >> >> news:92675db4-4996-4bdc-a9bc-bf688a17ed0e@k19g2000prh.googlegroups.com... >> >> > I have been searching google all day trying to find a way to use win32 >> > to retrive a computer's local time from the bios clocl, rather than >> > the system time, in the event that someone changed the system date >> > (accidentally or intentionally). >> >> If anyone changes the system date, the hardware real-time clock gets >> changed >> too. Are you trying to get a date and time from a more reliable source >> that >> the computer owner? You can make a request across the web and use >> asymmetric encryption to verify that it came from the trusted source, but >> the computer owner can just change your program to skip the check. >> >> There really is no way to secure data being used in an untrusted >> environment -- MMORPG companies spend millions of dollars trying and >> still >> fail. >> >> >> >> >> >> > I found the win32_currenttime, but using system.management classes >> > with wmi this parameter returns a collection with a count of zero. >> > msdn has information on the getsystemtime function, but says it is >> > part of the Provider classes which are obsolete and recomments using >> > system.management. >> >> > Any one know how to do this? >> >> > Bill >> >> > __________ Information from ESET NOD32 Antivirus, version of virus >> > signature database 4153 (20090613) __________ >> >> > The message was checked by ESET NOD32 Antivirus. >> >> >http://www.eset.com >> >> __________ Information from ESET NOD32 Antivirus, version of virus >> signature database 4153 (20090613) __________ >> >> The message was checked by ESET NOD32 Antivirus. >> >> http://www.eset.com- Hide quoted text - >> >> - Show quoted text - > I like your updates suggestion. Any serious cracker would not likely
be a buyer so I am really trying to focus on potential customers. BTW, I made the trial version such that it will continue to execute forever, but if the end of the trial period is detected it simply displays a nag screen with an upgrade button and then posts an expired message in the title of the main form. My thinking is that usage generates word-of-mouth marketing. Show quoteHide quote On Jun 15, 5:07 pm, "Ben Voigt [C++ MVP]" <r...@newsgroups.nospam> wrote: > Ok, I suppose you want to protect your software against torrent users but > not against the three real hackers in the world who will bypass the trial > check, putting in the effort to get those last three users to pay for their > licenses just isn't worth it. > > So implement a "check for updates at startup" feature, and if a trial user > tries to disable it politely inform them that doing so requires the paid > version. Then you'll get a reliable timestamp served up by your own web > host. > >
deleting row from dataset
Playing an .avi file in a C# app. Garbage collection and other questions I have Button Skinnning File database less than 10-20 MB String.Format D0, D1, D2, D3 change by variable Problem reading special characters into a list box if or statment Linq Query on XML file. Please, what am I doing wrong? How to get the MAC address? |
|||||||||||||||||||||||