PDA

View Full Version : ValidateSN question



nicwilson
01-05-2005, 12:28 AM
Hi,

I have InstallShield X Express and I have the ValidateSN dll working fine. However I want to pass the DLL a unique key for decryption which is not embedded in the dll itself. The USERNAME field would be perfect to use to pass such information, but strangely this is not passed as a parameter as expected.

Is there anyway I can pass the username field or a way I can access it from the DLL?

cheers
NicW

krabats
06-28-2005, 01:20 AM
It's quite simple to use ValidateSN from a dynamic link library. But ... with "Company name" and "User name" there is something wrong. In my opinion we can use only serial number in cases when software installation can be used globally... such as Windows - million of users. In most cases we should bind serial number with "user name". There is no chance to get user name and company name in a normal way.

But.. there is one abnormal way to retrieve this info.

Firstly - we can get Installation window handle. Install Shield help says, that "HWND hwnd"(one of input parameter of a ValidateSN function) is the handle of the installation window (BLA BLA BLA ... BULLSHIT - it allways is NULL).

HWND h = FindWindow("MsiDialogCloseClass","Application installation title");
// second parameter sample : "test - InstallShield Wizard"

now h is the handle of the installation window.

next using code bolow we can get Company and username.

long ui = 200; // length of buffer u
char u[200]; // buffer u , that receives the content of company or username
SendMessage(GetWindow(h,GW_CHILD),WM_GETTEXT,ui,(long)u);
// ShowMessage(u);
SendMessage(GetWindow(GetWindow(GetWindow(h,GW_CHILD),GW_HWNDNEXT),GW_HWNDNEXT),WM_GETTEXT,ui,(long)u);
// ShowMessage(u);


It works, but in my opinion this is an abnormal way to get username and company name.