Superfly-Inc / ShowKeyPlus

Windows product key finder and validation checker
MIT License
930 stars 162 forks source link

WindowsPE CLI not working #21

Closed zathorian closed 5 years ago

zathorian commented 5 years ago

Hi,

Thanks for the tool!

When using the tool (recent version) in CLI mode in Windows PE (ADK 1803) it does create the file, however the values are not added (please see attached file key.txt ).

It does show all information when running in GUI mode, however unlike in Windows 10 it needs several seconds to show the values (I do see a spinning circle first which I do not get in Windows 10). Therefore I suspect a timing issue that in CLI mode the file is written too soon.

I do have tried also the older version and either it does not run on PE at all or it has the same behaviour.

Thanks again, Zathorian

Superfly-Inc commented 5 years ago

Thanx Zathorian

CLI mode has largely been untested in WinPE.

I agree, most likely a threading issue (the spinner should not be visible in CLI mode at all.)

I will look into this and report back.

Thanx for your feedback.

zathorian commented 5 years ago

Thanks, looking forward! If you need me to test anything or to provide mor information, I am happy to help.

Btw my text was mistakable. I do see the spinner only in Windows PE and only in GUI mode. The CLI mode is without any GUI element as it should be. However in Windows 10 I do not get the spinner in GUI mode which has lead to my assumption that maybe that delay with the spinner is causing the threading/timing issue.

zathorian commented 5 years ago

Thanks for the new version. I tested it in Windows PE with these results:

Superfly-Inc commented 5 years ago

Thanx for this, much appreciated.

I don't have a working WinPE test environment yet. I just did some code clean-up (switching GUI dependencies etc) - I will let you know when I get it working my side ;)

Cheers.

zathorian commented 5 years ago

Ok, thanks again. Not sure if the license does allow to upload a PE ISO here (likely not), so if you need any information how to create a WinPE disk/iso, I am looking forward to provide you those.

One last result from my side before I wait for the new version. When using WinPE with a hardware which has no OS installed yet (=blank disk - my tests before have always been done with a preinstalled Windows 10) I do get this error in CLI mode: pe_no_oem_cli Interestingly I do get then a file which contains the proper OEM license key! (replaced in the upload by XXXXX) key.txt

In GUI mode I do get: no_OS_GUI

Superfly-Inc commented 5 years ago

@zathorian Thanx, I have set up WinPE - I wanted it as basic as possible ( only cmd, notepad and NetFx) I note saving the text file from the GUI gives a ClassID error - this is related to lack of explorer.exe - I will need to handle that exception - any ideas? Default to X:\ or prompt for manual path?

@bessonniy Thanx, noted.

zathorian commented 5 years ago

For me it does not matter really where the GUI file is written to as long as it would work. X:\ would be fine by default, however I do not know if all WinPE editions will mount as X (I assume they should). So maybe use an environment variable like %SystemDrive% or %TEMP% instead. Or maybe better - default to the location the exe is located as the user should always know where that file is as he is calling it. Handle the file save / IO exceptions (e.g. if called from a mapped network share without write access) and use then %TEMP%.

Superfly-Inc commented 5 years ago

@zathorian

Please test update https://github.com/Superfly-Inc/ShowKeyPlus/releases/tag/ShowKeyPlusWinPE

zathorian commented 5 years ago

Thanks and sorry for the late reply. I was afk during the weekend.

I tested the new build with these results (all from within WinPE):

It is making good progress, but it is not there yet. Thanks again! If you need anything else tested, I am glad to help.

Superfly-Inc commented 5 years ago

Thanx @zathorian

Good to see the initial test went well - I did not code/test for without an installed Windows OS.

TODO:

  1. Per screenshot 1 above

    • Check for CLI mode when no OS installed.
    • Change Yes/No to OK button which closes the app. if no OS and no OEM found (We can't search without Windows present)
    • if OEM found - OK button saves txt file to StartupPath (as per current beta)
  2. The missing object reference in question is the Offreg.dll - change to only extract when OS present.

I'm winging it here as PE is new to me (not the easiest to debug on, gotta say) - please let me know if I'm missing anything.

zathorian commented 5 years ago

Yes, that summarizes it quite well. However here are the points in my words (sorted by priority):

Thanks!

Superfly-Inc commented 5 years ago

@zathorian

New Beta with some fixes.

Re: CLI file saved as "key.txt" to the full path

The full file path will be shown if it is explicit in the command. Eg. this command... C:>ShowKeyPlus.exe C:\Users\Craig\source\repos\ShowKey\bin\x64\Debug\Key.txt.

returns this... C:>File saved as C:\Users\Craig\source\repos\ShowKey\bin\x64\Debug\Key.txt.

zathorian commented 5 years ago

Test results based on the recent version (as always from within WinPE only):

Bottom line, very good progress.

For me the one remaining priority issue is that it does not close itself anymore if an OS is found in CLI mode. Worst case I would have to write something in my wrapper script that it will be killed after some time but I would like to avoid that if possible.

Superfly-Inc commented 5 years ago

@zathorian

Thanx for the feedback. Good work ;)

The interaction with Console is problematic as cmd.exe seems to have very set parameters within which it operates, but I want to get that working. As part of the refactoring process I will try some other methods to make it as seamless as possible.

I appreciate your input.

zathorian commented 5 years ago

I implemented a powershell wrapper in the way that I do NOT wait till the process closes. instead every now and then I check if the file has been written properly. That way it does work, however it is not ideal. Positive aspect is that this way it is working 100% fine for my use case 👍 currently more extensive tests are running. I do not expect any new issues though. Thanks!

Superfly-Inc commented 5 years ago

@zathorian

That's excellent!

I will close this as an issue and consider the oustandings as enhancements for a later release.

I usually release a new version with each Windows RTM release - although I don't see any new Windows editions or API breakages we need to cater for in the May 2019 Update...)

Thanx for your support.