mreha
asked on
WinVerifyTrust API
What do you need in your development environment to
use the WinVerifyTrust() API? When I use the API it
gives an error 'linked to missing export ADVAPI32.DLL:
WinVerifyTrust'.
The following sample code is used in a simple
dialog box app to test the API. I have a personal
and private key to digitally sign code with. I have
tested the keys out using the tools in the ActiveX
SDK. The error happens when I run the test app,
not when the API is being invoked.
// Test the Win Veriy Trust API
void CWinVerifyDlg::OnTestButto n()
{
HRESULT hResult;
GUID ActionID;
GUID SubjectType = WIN_TRUST_SUBJTYPE_PE_IMAG E;
WIN_TRUST_ACTDATA_SUBJECT_ ONLY ActionData;
WIN_TRUST_SUBJECT_FILE SubjectFile;
SubjectFile.hFile = 0;
SubjectFile.lpPath = (LPCWSTR)"\\Test\\Authent\ \SwUpdate. exe";
ActionData.SubjectType = &SubjectType;
ActionData.Subject = &SubjectFile;
hResult = ::WinVerifyTrust (this->GetSafeHwnd (), &ActionID, &ActionData);
switch (hResult)
{
case ERROR_SUCCESS:
AfxMessageBox ("Trusted Code!");
break;
case TRUST_E_SUBJECT_NOT_TRUSTE D:
AfxMessageBox ("Not Trusted Code!");
break;
case TRUST_E_PROVIDER_UNKNOWN:
AfxMessageBox ("Provider Unknown!");
break;
case TRUST_E_ACTION_UNKNOWN:
AfxMessageBox ("Action Unknown!");
break;
case TRUST_E_SUBJECT_FORM_UNKNO WN:
AfxMessageBox ("Form Unknown!");
break;
default:
AfxMessageBox ("Error Unknown!");
break;
}
}
use the WinVerifyTrust() API? When I use the API it
gives an error 'linked to missing export ADVAPI32.DLL:
WinVerifyTrust'.
The following sample code is used in a simple
dialog box app to test the API. I have a personal
and private key to digitally sign code with. I have
tested the keys out using the tools in the ActiveX
SDK. The error happens when I run the test app,
not when the API is being invoked.
// Test the Win Veriy Trust API
void CWinVerifyDlg::OnTestButto
{
HRESULT hResult;
GUID ActionID;
GUID SubjectType = WIN_TRUST_SUBJTYPE_PE_IMAG
WIN_TRUST_ACTDATA_SUBJECT_
WIN_TRUST_SUBJECT_FILE SubjectFile;
SubjectFile.hFile = 0;
SubjectFile.lpPath = (LPCWSTR)"\\Test\\Authent\
ActionData.SubjectType = &SubjectType;
ActionData.Subject = &SubjectFile;
hResult = ::WinVerifyTrust (this->GetSafeHwnd (), &ActionID, &ActionData);
switch (hResult)
{
case ERROR_SUCCESS:
AfxMessageBox ("Trusted Code!");
break;
case TRUST_E_SUBJECT_NOT_TRUSTE
AfxMessageBox ("Not Trusted Code!");
break;
case TRUST_E_PROVIDER_UNKNOWN:
AfxMessageBox ("Provider Unknown!");
break;
case TRUST_E_ACTION_UNKNOWN:
AfxMessageBox ("Action Unknown!");
break;
case TRUST_E_SUBJECT_FORM_UNKNO
AfxMessageBox ("Form Unknown!");
break;
default:
AfxMessageBox ("Error Unknown!");
break;
}
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.