while hacking on slwga.dll, I had to write this so I could watch how slwga.dll slc.dll and sppc.dll interacted with a debugger gets the Genuine Status Code: Declare Auto Function SLIsGenuineLocal Lib "slwga.dll" (ByRef slid As Guid, ByRef GenuineState As Integer, ByVal UIopts As Integer) As UInteger Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Try Dim AppID As New Guid("55c92734-d682-4d71-983e-d6ec3f16059f") Dim GenuineState = 0 Dim UIopts = 0 SLIsGenuineLocal(AppID, GenuineState, UIopts) MessageBox.Show(GenuineState) Catch err As Exception MessageBox.Show(err.Message) End Try End Sub
Damn, no matter what I do, I cannot kill the 'sppsvc' in VB.NET... I tried what alphawaves and PAYMYRENT suggested, but to no avail... I am starting to wish I could just run an elevated cmd.exe in VB and do it that way...but can't do that either since there is no way to run cmd.exe "pre-elevated" from VB (at least not that I know of). Damn Microsoft, making things hard. Not even "sc.exe stop sppsvc" will kill it from inside of VB on my computer (PAYMYRENT's suggestion). I will keep plugging away at it.
have you tried: stop: PHP: Using p1 As New Process p1.StartInfo.CreateNoWindow = True p1.StartInfo.FileName = "cmd.exe" p1.StartInfo.Arguments = "/c net stop sppsvc /y" Try p1.StartInfo.WindowStyle = ProcessWindowStyle.Hidden p1.Start() Catch ex As Exception MessageBox.Show(ex.Message) End Try p1.WaitForExit() End Using start: PHP: Using p2 As New Process p2.StartInfo.CreateNoWindow = True p2.StartInfo.FileName = "cmd.exe" p2.StartInfo.Arguments = "/c net start sppsvc /y" Try p2.StartInfo.WindowStyle = ProcessWindowStyle.Hidden p2.Start() Catch ex As Exception MessageBox.Show(ex.Message) End Try p2.WaitForExit() End Using Alfa
Ok alphawaves, that works!!! sppsvc now stopped...so now I am able to temporarily stop the service, one thing down... Now my problem is that I get an access exception for pkeyconfig.xrm-ms when trying to set it's attributes to normal so I can replace it (with the backup), so I assume that I need to take ownership of that file before trying to replace it... I will try that
lol my token restore program does it all and i only take ownership then overwrite and it has no problems doing it. and when you ran the code i posted did you set it to capture the output from sc.exe to see what was going wrong?
I got the sc.exe commands working, but I suspect they are not needed if I just take ownership of the 2 files right? Either way, it works perfectly now, stopping sppsvc temporarily and taking ownership of the 2 files before replacing them...
when i wrote my tool i found that i needed to take ownership and stop sppsvc before it worked right then the restore part went stop sppsvc then take ownership then start sppsvc then install key
Oh well ... this way is too easy, HotCarl... Everyone should have its own role ... PayMyRent will break it ... and you'll have to fix it...
i tried the OEM branding install and now i have a HP logo in media center and an Acer logo in the system control panel
All I did was add the logo and information to Computer Properties window. Since I dont use it, I didn't realize that there was a logo in the Control Panel too >.< Is the string value for the Control Panel OEM image in "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\OEMInformation" as well?
:O Running an elevated cmd line is easy Code: Using p2 As New Process p2.StartInfo.CreateNoWindow = True p2.StartInfo.FileName = "cmd.exe" p2.StartInfo.Arguments = "/c net stop sppsvc" Try p2.StartInfo.WindowStyle = ProcessWindowStyle.Hidden p2.Start() Catch ex As Exception MessageBox.Show(ex.Message) End Try p2.WaitForExit() End Using Now slap an admin manifest on your app and it will work fine
I did that and it did not work right away, and have had the manifest set to require admin rights from the get-go... I have it working perfectly now though, had to use a slightly different set of arguments. Thanks for the advice.
Well that is the code I use and it works perfect, just thought I'd share it. Good to know you got it working.
Yeah, I don't know what my problem is, but code that has worked on other peoples computers does not always seem to work on mine without tweaking...its picky or something. :-/ EDIT: I think I have most of the kinks worked out now though...I hope.
And with regards to stopping sppsvc, to edit tokens or any protected license store you need to stop sppsvc, so you know