Hi, I'm making a program to bypass win7 activation, but I'm having problems with the installer. Of course the one who helps me out will see his name in the credits list if it's ever going to be released. The error appears when I run the app as admin, a nice jit (just in time debugger) window pops up. Some text in the jit error is in dutch, so I translated it to english. GraceExtender is a file with no extension. error: Why can't it acces the file, am I doing something wrong? It looks to me as if it wants to write to the file when the file isn't fully written to the disk yet. This error also appears in another app, the same there, it needs to write to a file that is created 1 line above in the vb code. Anyone knows what's wrong? Thanks
Stan,What are you running X64 / or X32 OS? If you run X64 as OS and you compile do not compile the app as x64 app it might be possible \System32\ gets redirected to \SysWow64\ Have had this issue l while back, maybe it is related, maybe its not... but worth to try, isn't?
No I'm running 32bit, and even on x64 the system32 folder contains the x64 files and the syswow64 folder contains the 32bit files. And that shouldn't make a difference anyway I think.
Just use this line Code: System.IO.File.WriteAllText(strSystem32 & "\GraceExtender", strInstallDirectory) It will create a new file and put all the text into the file and close it. The problem with your code is, when you use the line below Code: System.IO.File.Create(strSystem32 & "\GraceExtender") it creates a new handle for the file and does not close it, so the next line fails because the file is already in use.
You'd be best off just making the text file and pack it as a resource and use System.IO.File.WriteAllBytes(path, resourcename)
But the file has to stay on the users hdd, when he runs the app another time I need to read it again, can dat be done with a recourse? And now I have this line only: System.IO.File.WriteAllText(strSystem32 & "\GraceExtender", strInstallDirectory) but it says "file not found", when I look at it however all is written correctly as it should be.
You know, I'll just put the info in the registry instead of in a file, that's the easiest. But thanks though.
Grrr, now I've another problem: How can I get a registryvalue into an integer? I think I should use dword then? I need to check if the value in the registry is higher or lower then an other value. And does anyone know how to see whether windows is in grace period or not?
Code for finding grace period. Code: Imports System Imports System.Management Imports System.Windows.Forms Namespace WMISample Public Class MyWMIQuery Public Overloads Shared Function Main() As Integer Try Dim searcher As New ManagementObjectSearcher( _ "root\CIMV2", _ "SELECT * FROM SoftwareLicensingProduct") For Each queryObj As ManagementObject in searcher.Get() Console.WriteLine("-----------------------------------") Console.WriteLine("SoftwareLicensingProduct instance") Console.WriteLine("-----------------------------------") Console.WriteLine("GracePeriodRemaining: {0}", queryObj("GracePeriodRemaining")) Next Catch err As ManagementException MessageBox.Show("An error occurred while querying for WMI data: " & err.Message) End Try End Function End Class End Namespace
Sorry but I can't get this working, I'm a newbe in programming It gives lot's of errors, but you can just give all the code (every word you can see in visual studio)? Maybe in the form of a console app that just pops up a msgbox that says in grace or not in grace, that would really help me out. And how can you see whether windows is activated or showing nagscreens in case the graceperiod is expired?
i cant help you with the integer part but these codes typed into cmd prompt will show you info on the os whether its activated or grace period. slmgr -dli slmgr -xpr slmgr -dlv
First you need to understand how WMI query woks. Add reference to System.Management for your project. Code: Dim searcher As New ManagementObjectSearcher("root\CIMV2", "SELECT * FROM SoftwareLicensingProduct WHERE LicenseStatus > 1") This line queries the SoftwareLicensingProduct class and return an array of ManagementObject which have LicenseStatus greater than 1. Below is the list of values for License Status. Code: LicenseStatus Data type: uint32 Access type: Read-only Specifies the license status of this product application. The following values are possible. ValueDescription 0Unlicensed 1Licensed 2OOBGrace 3OOTGrace 4NonGenuineGrace 5Notification 6ExtendedGrace Code: For Each queryObj As ManagementObject in searcher.Get() Console.WriteLine("GracePeriodRemaining: {0}", queryObj("GracePeriodRemaining")) This line displays the GracePeroidRemaining in minutes. You only need to add these three lines to your code and don't forget to add the reference to your project.
OK I understand how it works, but it gives 2 errors: type ManagementObjectSearcher is not defined type ManagementObjectSearcher is not defined I did add these 3 lines, they are above the public class 'myform' Imports System Imports System.Management Imports System.Windows.Forms
Goto Project -> Add Reference, select System.Management. This is what i have in my source, Code: Imports System.Management Module Module1 Sub Main() Dim searcher As New ManagementObjectSearcher("root\CIMV2", "SELECT * FROM SoftwareLicensingProduct WHERE LicenseStatus > 1") For Each queryObj As ManagementObject In searcher.Get() Console.WriteLine("GracePeriodRemaining: {0}", queryObj("GracePeriodRemaining")) Next queryObj End Sub End Module