winLicenseSDK

Hi,
Hope I’m posting this in the right place
Try to get hardwareID in xojo using the winLicenseSDK.dll
I keep getting back:
1111-2222-3333-4444-5555-6666-7777-8888
as hardwareID can’t be right: VB definition is:
Public Declare Function WLHardwareGetID Lib “WinLicenseSDK.dll” (ByVal pHardwareId As String) As Boolean

Parameters
pHardwareId
[out] Pointer to a buffer that will receive a null-terminated string with the hardware ID for the current machine.
Return Values
If the function succeeds, the return value is True.
If the function fails, the return value is False.

my code:
dim s as string
dim mb as memoryblock
if DebugBuild then
Declare Function WLHardwareGetID Lib “C:\WinLicense\WinlicenseSDK\WinLicenseSDK.dll” (ByVal pHardwareId As Ptr) As Boolean
If System.IsFunctionAvailable(“WLHardwareGetID”, “C:\WinLicense\WinlicenseSDK\WinLicenseSDK.dll”) Then

  mb = new memoryblock(512)
  call WLHardwareGetID(mb)
  s = mb.CString(0)
  return s
Else
  Msgbox "DLL not present"
End If

else
Declare Function WLHardwareGetID Lib “WinLicenseSDK.dll” ( ByVal pHardwareId As Ptr) As Boolean
If System.IsFunctionAvailable(“WLHardwareGetID”, “WinLicenseSDK.dll”) Then

  mb = new memoryblock(512)
  call WLHardwareGetID(mb)
  s = mb.CString(0)
  return s
Else
  Msgbox "DLL not present"
End If

end if
'---------------------
has anyone played with this?
can you spot the problem?

tia

Could it be that you need a license to use WinLicenseSDK? That sure looks like a sample you’d pass back if someone hadn’t paid.

I have a license and winlicense support states it should work after you protect the app

Note that certain protection or bundling mechanisms may in fact break your app.
This has been covered in several threads on the forums trying to figure out how to make a single file exe for Windows.
Does their documentation makes any mention of hat return codes / invalid license keys the dll might return ?

The call returns a boolean to say if it succeeded or not.
You are ignoring the return value by using Call

Try

If WLgetHardwareID( ..... ) then //do stuff else msgbox "Call failed" end if

Have you encrypted the app?
Have you called CheckRegistration?
Do you need to call WDC_Initialize?

[quote=240685:@Norman Palardy]Note that certain protection or bundling mechanisms may in fact break your app.
This has been covered in several threads on the forums trying to figure out how to make a single file exe for Windows.
Does their documentation makes any mention of hat return codes / invalid license keys the dll might return ?[/quote]
Yes I am aware new versions of xojo wont work correctly just trying to use the winlicenseSDK to pull a hardwareID
as for return code I posted the params

[quote=240688:@Jeff Tullin]The call returns a boolean to say if it succeeded or not.
You are ignoring the return value by using Call

Try

If WLgetHardwareID( ..... ) then //do stuff else msgbox "Call failed" end if

not sure how to code that
its one of my many problems
I’m guessing at code using what I could gleam from the Windows functionality suite on github

Have you encrypted the app?
Have you called CheckRegistration?
Do you need to call WDC_Initialize?[/quote]

yes I protected the app to no avail
just tryin to get hardwareID SDK does not require Checkregistratiobn or WDC_Initilize calls

[quote=240692:@Raymond Charles]Yes I am aware new versions of xojo wont work correctly just trying to use the winlicenseSDK to pull a hardwareID
as for return code I posted the params[/quote]
I’m guessing it wont work with Xojo or Real Studio because of how they generate 32 bit applications
It’s not illegal but its definitely unconventional and most packagers that wrap an app + dll’s into a single exe break the apps entirely because of this
I expect that this will have the same effect

[quote=240700:@Norman Palardy]I’m guessing it wont work with Xojo or Real Studio because of how they generate 32 bit applications
It’s not illegal but its definitely unconventional and most packagers that wrap an app + dll’s into a single exe break the apps entirely because of this
I expect that this will have the same effect[/quote]
I think your right I was just looking thru my support emails from Oreans Tech and they kinda comfirm it
"the main problem is that Xojo seems to just interpret your embedded source code, so your code is already inside the EXE, which is interpreted in runtime. So, the applied protection is always weak (using any protector) as your original code is already there, visible on memory to pass it to the Xojo interpreter. Anyway, I’m not 100% about this and need to make further checks. "

no way to know if I have the code is right if the app is never truly protected strange catch 22
we have winlicense for .net projects but I just wanted to generate a hardwareID as a possible xojo software registration solution

maybe theres another way any suggestions?

@Jeff Tullin
try this same result
Declare Function WLHardwareGetID Lib “WinLicenseSDK.dll” ( ByVal pHardwareId As Ptr) As Boolean
If System.IsFunctionAvailable(“WLHardwareGetID”, “WinLicenseSDK.dll”) Then

  mb = new memoryblock(512)
  if WLHardwareGetID(mb) then
    call WLHardwareGetID(mb)
  else
    msgbox "Call failed"
  end if
  s = mb.CString(0)
  return s
Else
  Msgbox "DLL not present"
End If

[quote=240704:@Raymond Charles]I think your right I was just looking thru my support emails from Oreans Tech and they kinda comfirm it
"the main problem is that Xojo seems to just interpret your embedded source code, so your code is already inside the EXE, which is interpreted in runtime. So, the applied protection is always weak (using any protector) as your original code is already there, visible on memory to pass it to the Xojo interpreter. Anyway, I’m not 100% about this and need to make further checks. "
[/quote]
Lets be clears as these guys are 100% wrong.
Xojo is NOT interpretted.
They’re 100% wrong on that count.
There is NO source code in the compiled application.

I wrote that in bold so people will see it as its WRONG WRONG WRONG

It just loads & runs in an unconventional manner - basically its not a proper PE32 application.

You could call directly into one of the many Windows API;s to get some kind of hardware key from it
There are many that you should be able to read - the HD serial number, the CPU serial # etc
The downside to this is that IF one of those components changes (say the person replaces the HD) then your license immediately says “not licensed” and they have a problem that may require some support to get reinstalled

https://msdn.microsoft.com/en-us/library/windows/desktop/aa364993(v=vs.85).aspx
https://msdn.microsoft.com/en-us/library/windows/desktop/aa394373(v=vs.85).aspx

well the thinking here is CPU and windows product key never hard drive serial.
looked into the links you provided I have no idea how to implement that in xojo
can you provide an example.
[Edit}

just wondering why my code is not working?

I’ve never used that product so I cant say it is or is not working as expected
Their docs may tell you something about that specific key being returned

Not sure if the Windows Functionality Suite isn’t instructive here
It may not have the specific API’s implemented but it has a bunch - like HD serial number :slight_smile:

I converted the VB exampleSDK via the xojo’x vbconverter
It converts to External Methods
how to you call and External Method?
and store results in a text field?