| | |
Help regarding MSI Serial Key Validation
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Aug 2006
Posts: 57
Reputation:
Solved Threads: 0
hi all,
I am using ORCA to validate the product key in C# 2005 windows application.
i am using the following C++ code in a dll to be added to the MSI for validation.
but when i execute the above code, i am getting the following error.
error LNK2019: unresolved external symbol _MsiSetPropertyA@12 referenced in function "unsigned int __stdcall ValidateSerial(unsigned long)" (?ValidateSerial@@YGIK@Z) CustomAction.obj
i have included and
I am a beginner in VC++ and could anybody help me with some suggestions
Thanks in advance.
Regards
exelio
I am using ORCA to validate the product key in C# 2005 windows application.
i am using the following C++ code in a dll to be added to the MSI for validation.
C++ Syntax (Toggle Plain Text)
UINT __stdcall ValidateSerial(MSIHANDLE hInstall) { TCHAR szPidKey[PIDKEY_LENGTH]; DWORD dwLen = sizeof(szPidKey) / sizeof(szPidKey[0]); ///retrieve the text entered by the user UINT res = MsiGetPropertyA(hInstall, _T("PIDKEY"), szPidKey, &dwLen); if(res != ERROR_SUCCESS) { //fail the installation return 1; } bool snIsValid = true; //validate the text from szPidKey according to your algorithm //put the result in snIsValid //the template we use is <###-####> = ; # digit between 0 and 9 //the algorithm is very simple (XY * Z + 7) * 13 = ABCD / 2 int xy = DIGIT(szPidKey[0]) * 10 + DIGIT(szPidKey[1]); int z = DIGIT(szPidKey[2]); int left = ((xy * z + 7) * 13 ) * 2; int right = DIGIT(szPidKey[4]); right = right * 10 + DIGIT(szPidKey[5]); right = right * 10 + DIGIT(szPidKey[6]); right = right * 10 + DIGIT(szPidKey[7]); snIsValid = (left != 0) && (right != 0) && (left == right); TCHAR * serialValid = NULL; if(snIsValid) serialValid = _T("TRUE"); else { //eventually say something to the user ::MessageBox(0, _T("Invalid Serial Number"), _T("Message"), MB_ICONSTOP); serialValid = _T("FALSE"); } res = MsiSetPropertyA(hInstall, _T("SERIAL_VALIDATION"), serialValid); if(res != ERROR_SUCCESS) { //fail the installation return 1; } //the validation succeeded - even the serial is wrong //if the SERIAL_VALIDATION was set to FALSE the installation will not continue return 0; }
error LNK2019: unresolved external symbol _MsiSetPropertyA@12 referenced in function "unsigned int __stdcall ValidateSerial(unsigned long)" (?ValidateSerial@@YGIK@Z) CustomAction.obj
i have included and
I am a beginner in VC++ and could anybody help me with some suggestions
Thanks in advance.
Regards
exelio
Last edited by Ancient Dragon; Dec 18th, 2007 at 4:49 pm. Reason: add code tags
![]() |
Similar Threads
- I need help (Viruses, Spyware and other Nasties)
- Cachecachekit! (Viruses, Spyware and other Nasties)
- "Home Search 'Assistent'"... yet again (Viruses, Spyware and other Nasties)
- Removal of Home Search Assistent (Viruses, Spyware and other Nasties)
- My HiJackThis Log (Viruses, Spyware and other Nasties)
- I can't remove about:blank (Viruses, Spyware and other Nasties)
- Another Trojan.Bookmarker.Gen (Viruses, Spyware and other Nasties)
Other Threads in the C++ Forum
- Previous Thread: Compare in templatized data structure
- Next Thread: Word break and line break in Rich Edit Control
| Thread Tools | Search this Thread |
api application array arrays based beginner binary bitmap c++ c/c++ calculator char char* class classes coding compile compiler console conversion convert count data database delete desktop developer directshow dll dynamiccharacterarray email encryption error file forms fstream function functions game generator getline graph homeworkhelper iamthwee ifstream input int integer java lib linux list loop looping loops map math matrix memory multiple newbie news node number numbertoword output parameter pointer problem program programming project proxy python random read recursion recursive reference return rpg sorting string strings struct template templates text tree url vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets





