libatl added.
Aesthetic modifications
This commit is contained in:
parent
688fd48976
commit
c7e3cdfe99
@ -140,7 +140,7 @@ UINT MSICA_API MSICAInitialize(MSIHANDLE hInstall)
|
||||
// Fetch one record from the view.
|
||||
uiResult = ::MsiViewFetch(hViewBinary, &hRecord);
|
||||
if (uiResult == NO_ERROR)
|
||||
uiResult = ::MsiRecordGetStream(hRecord, 1, binCert);
|
||||
uiResult = ::MsiRecordReadStream(hRecord, 1, binCert);
|
||||
::MsiViewClose(hViewBinary);
|
||||
if (uiResult != NO_ERROR) break;
|
||||
} else
|
||||
@ -457,7 +457,7 @@ UINT MSICA_API MSICAInitialize(MSIHANDLE hInstall)
|
||||
// Fetch one record from the view.
|
||||
uiResult = ::MsiViewFetch(hViewBinary, &hRecordBin);
|
||||
if (uiResult == NO_ERROR)
|
||||
uiResult = ::MsiRecordGetStream(hRecordBin, 1, binProfile);
|
||||
uiResult = ::MsiRecordReadStream(hRecordBin, 1, binProfile);
|
||||
::MsiViewClose(hViewBinary);
|
||||
if (uiResult != NO_ERROR) break;
|
||||
|
||||
|
@ -672,6 +672,7 @@ UINT ExecuteSequence(MSIHANDLE hInstall);
|
||||
// Local includes
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "../../../lib/atl/atlmsi.h"
|
||||
#include <atlfile.h>
|
||||
#include <atlstr.h>
|
||||
#include <msiquery.h>
|
||||
@ -708,173 +709,6 @@ inline VOID GuidToString(const GUID &guid, ATL::CAtlStringW &str)
|
||||
} // namespace MSICA
|
||||
|
||||
|
||||
inline UINT MsiGetPropertyA(MSIHANDLE hInstall, LPCSTR szName, ATL::CAtlStringA &sValue)
|
||||
{
|
||||
DWORD dwSize = 0;
|
||||
UINT uiResult;
|
||||
|
||||
// Query the actual string length first.
|
||||
uiResult = ::MsiGetPropertyA(hInstall, szName, "", &dwSize);
|
||||
if (uiResult == ERROR_MORE_DATA) {
|
||||
// Prepare the buffer to read the string data into and read it.
|
||||
LPSTR szBuffer = sValue.GetBuffer(dwSize++);
|
||||
if (!szBuffer) return ERROR_OUTOFMEMORY;
|
||||
uiResult = ::MsiGetPropertyA(hInstall, szName, szBuffer, &dwSize);
|
||||
sValue.ReleaseBuffer(uiResult == NO_ERROR ? dwSize : 0);
|
||||
return uiResult;
|
||||
} else if (uiResult == NO_ERROR) {
|
||||
// The string in database is empty.
|
||||
sValue.Empty();
|
||||
return NO_ERROR;
|
||||
} else {
|
||||
// Return error code.
|
||||
return uiResult;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
inline UINT MsiGetPropertyW(MSIHANDLE hInstall, LPCWSTR szName, ATL::CAtlStringW &sValue)
|
||||
{
|
||||
DWORD dwSize = 0;
|
||||
UINT uiResult;
|
||||
|
||||
// Query the actual string length first.
|
||||
uiResult = ::MsiGetPropertyW(hInstall, szName, L"", &dwSize);
|
||||
if (uiResult == ERROR_MORE_DATA) {
|
||||
// Prepare the buffer to read the string data into and read it.
|
||||
LPWSTR szBuffer = sValue.GetBuffer(dwSize++);
|
||||
if (!szBuffer) return ERROR_OUTOFMEMORY;
|
||||
uiResult = ::MsiGetPropertyW(hInstall, szName, szBuffer, &dwSize);
|
||||
sValue.ReleaseBuffer(uiResult == NO_ERROR ? dwSize : 0);
|
||||
return uiResult;
|
||||
} else if (uiResult == NO_ERROR) {
|
||||
// The string in database is empty.
|
||||
sValue.Empty();
|
||||
return NO_ERROR;
|
||||
} else {
|
||||
// Return error code.
|
||||
return uiResult;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
inline UINT MsiRecordGetStringA(MSIHANDLE hRecord, unsigned int iField, ATL::CAtlStringA &sValue)
|
||||
{
|
||||
DWORD dwSize = 0;
|
||||
UINT uiResult;
|
||||
|
||||
// Query the actual string length first.
|
||||
uiResult = ::MsiRecordGetStringA(hRecord, iField, "", &dwSize);
|
||||
if (uiResult == ERROR_MORE_DATA) {
|
||||
// Prepare the buffer to read the string data into and read it.
|
||||
LPSTR szBuffer = sValue.GetBuffer(dwSize++);
|
||||
if (!szBuffer) return ERROR_OUTOFMEMORY;
|
||||
uiResult = ::MsiRecordGetStringA(hRecord, iField, szBuffer, &dwSize);
|
||||
sValue.ReleaseBuffer(uiResult == NO_ERROR ? dwSize : 0);
|
||||
return uiResult;
|
||||
} else if (uiResult == NO_ERROR) {
|
||||
// The string in database is empty.
|
||||
sValue.Empty();
|
||||
return NO_ERROR;
|
||||
} else {
|
||||
// Return error code.
|
||||
return uiResult;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
inline UINT MsiRecordGetStringW(MSIHANDLE hRecord, unsigned int iField, ATL::CAtlStringW &sValue)
|
||||
{
|
||||
DWORD dwSize = 0;
|
||||
UINT uiResult;
|
||||
|
||||
// Query the actual string length first.
|
||||
uiResult = ::MsiRecordGetStringW(hRecord, iField, L"", &dwSize);
|
||||
if (uiResult == ERROR_MORE_DATA) {
|
||||
// Prepare the buffer to read the string data into and read it.
|
||||
LPWSTR szBuffer = sValue.GetBuffer(dwSize++);
|
||||
if (!szBuffer) return ERROR_OUTOFMEMORY;
|
||||
uiResult = ::MsiRecordGetStringW(hRecord, iField, szBuffer, &dwSize);
|
||||
sValue.ReleaseBuffer(uiResult == NO_ERROR ? dwSize : 0);
|
||||
return uiResult;
|
||||
} else if (uiResult == NO_ERROR) {
|
||||
// The string in database is empty.
|
||||
sValue.Empty();
|
||||
return NO_ERROR;
|
||||
} else {
|
||||
// Return error code.
|
||||
return uiResult;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
inline UINT MsiRecordGetStream(MSIHANDLE hRecord, unsigned int iField, ATL::CAtlArray<BYTE> &binData)
|
||||
{
|
||||
DWORD dwSize = 0;
|
||||
UINT uiResult;
|
||||
|
||||
// Query the actual data length first.
|
||||
uiResult = ::MsiRecordReadStream(hRecord, iField, NULL, &dwSize);
|
||||
if (uiResult == NO_ERROR) {
|
||||
if (!binData.SetCount(dwSize)) return ERROR_OUTOFMEMORY;
|
||||
return ::MsiRecordReadStream(hRecord, iField, (char*)binData.GetData(), &dwSize);
|
||||
} else {
|
||||
// Return error code.
|
||||
return uiResult;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
inline UINT MsiFormatRecordA(MSIHANDLE hInstall, MSIHANDLE hRecord, ATL::CAtlStringA &sValue)
|
||||
{
|
||||
DWORD dwSize = 0;
|
||||
UINT uiResult;
|
||||
|
||||
// Query the final string length first.
|
||||
uiResult = ::MsiFormatRecordA(hInstall, hRecord, "", &dwSize);
|
||||
if (uiResult == ERROR_MORE_DATA) {
|
||||
// Prepare the buffer to format the string data into and read it.
|
||||
LPSTR szBuffer = sValue.GetBuffer(dwSize++);
|
||||
if (!szBuffer) return ERROR_OUTOFMEMORY;
|
||||
uiResult = ::MsiFormatRecordA(hInstall, hRecord, szBuffer, &dwSize);
|
||||
sValue.ReleaseBuffer(uiResult == NO_ERROR ? dwSize : 0);
|
||||
return uiResult;
|
||||
} else if (uiResult == NO_ERROR) {
|
||||
// The result is empty.
|
||||
sValue.Empty();
|
||||
return NO_ERROR;
|
||||
} else {
|
||||
// Return error code.
|
||||
return uiResult;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
inline UINT MsiFormatRecordW(MSIHANDLE hInstall, MSIHANDLE hRecord, ATL::CAtlStringW &sValue)
|
||||
{
|
||||
DWORD dwSize = 0;
|
||||
UINT uiResult;
|
||||
|
||||
// Query the final string length first.
|
||||
uiResult = ::MsiFormatRecordW(hInstall, hRecord, L"", &dwSize);
|
||||
if (uiResult == ERROR_MORE_DATA) {
|
||||
// Prepare the buffer to format the string data into and read it.
|
||||
LPWSTR szBuffer = sValue.GetBuffer(dwSize++);
|
||||
if (!szBuffer) return ERROR_OUTOFMEMORY;
|
||||
uiResult = ::MsiFormatRecordW(hInstall, hRecord, szBuffer, &dwSize);
|
||||
sValue.ReleaseBuffer(uiResult == NO_ERROR ? dwSize : 0);
|
||||
return uiResult;
|
||||
} else if (uiResult == NO_ERROR) {
|
||||
// The result is empty.
|
||||
sValue.Empty();
|
||||
return NO_ERROR;
|
||||
} else {
|
||||
// Return error code.
|
||||
return uiResult;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
inline UINT MsiRecordFormatStringA(MSIHANDLE hInstall, MSIHANDLE hRecord, unsigned int iField, ATL::CAtlStringA &sValue)
|
||||
{
|
||||
UINT uiResult;
|
||||
@ -931,84 +765,6 @@ inline UINT MsiRecordFormatStringW(MSIHANDLE hInstall, MSIHANDLE hRecord, unsign
|
||||
#endif // !UNICODE
|
||||
|
||||
|
||||
inline UINT MsiGetTargetPathA(MSIHANDLE hInstall, LPCSTR szFolder, ATL::CAtlStringA &sValue)
|
||||
{
|
||||
DWORD dwSize = 0;
|
||||
UINT uiResult;
|
||||
|
||||
// Query the final string length first.
|
||||
uiResult = ::MsiGetTargetPathA(hInstall, szFolder, "", &dwSize);
|
||||
if (uiResult == ERROR_MORE_DATA) {
|
||||
// Prepare the buffer to format the string data into and read it.
|
||||
LPSTR szBuffer = sValue.GetBuffer(dwSize++);
|
||||
if (!szBuffer) return ERROR_OUTOFMEMORY;
|
||||
uiResult = ::MsiGetTargetPathA(hInstall, szFolder, szBuffer, &dwSize);
|
||||
sValue.ReleaseBuffer(uiResult == NO_ERROR ? dwSize : 0);
|
||||
return uiResult;
|
||||
} else if (uiResult == NO_ERROR) {
|
||||
// The result is empty.
|
||||
sValue.Empty();
|
||||
return NO_ERROR;
|
||||
} else {
|
||||
// Return error code.
|
||||
return uiResult;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
inline UINT MsiGetTargetPathW(MSIHANDLE hInstall, LPCWSTR szFolder, ATL::CAtlStringW &sValue)
|
||||
{
|
||||
DWORD dwSize = 0;
|
||||
UINT uiResult;
|
||||
|
||||
// Query the final string length first.
|
||||
uiResult = ::MsiGetTargetPathW(hInstall, szFolder, L"", &dwSize);
|
||||
if (uiResult == ERROR_MORE_DATA) {
|
||||
// Prepare the buffer to format the string data into and read it.
|
||||
LPWSTR szBuffer = sValue.GetBuffer(dwSize++);
|
||||
if (!szBuffer) return ERROR_OUTOFMEMORY;
|
||||
uiResult = ::MsiGetTargetPathW(hInstall, szFolder, szBuffer, &dwSize);
|
||||
sValue.ReleaseBuffer(uiResult == NO_ERROR ? dwSize : 0);
|
||||
return uiResult;
|
||||
} else if (uiResult == NO_ERROR) {
|
||||
// The result is empty.
|
||||
sValue.Empty();
|
||||
return NO_ERROR;
|
||||
} else {
|
||||
// Return error code.
|
||||
return uiResult;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
inline DWORD CertGetNameStringA(PCCERT_CONTEXT pCertContext, DWORD dwType, DWORD dwFlags, void *pvTypePara, ATL::CAtlStringA &sNameString)
|
||||
{
|
||||
// Query the final string length first.
|
||||
DWORD dwSize = ::CertGetNameStringA(pCertContext, dwType, dwFlags, pvTypePara, NULL, 0);
|
||||
|
||||
// Prepare the buffer to format the string data into and read it.
|
||||
LPSTR szBuffer = sNameString.GetBuffer(dwSize);
|
||||
if (!szBuffer) return ERROR_OUTOFMEMORY;
|
||||
dwSize = ::CertGetNameStringA(pCertContext, dwType, dwFlags, pvTypePara, szBuffer, dwSize);
|
||||
sNameString.ReleaseBuffer(dwSize);
|
||||
return dwSize;
|
||||
}
|
||||
|
||||
|
||||
inline DWORD CertGetNameStringW(PCCERT_CONTEXT pCertContext, DWORD dwType, DWORD dwFlags, void *pvTypePara, ATL::CAtlStringW &sNameString)
|
||||
{
|
||||
// Query the final string length first.
|
||||
DWORD dwSize = ::CertGetNameStringW(pCertContext, dwType, dwFlags, pvTypePara, NULL, 0);
|
||||
|
||||
// Prepare the buffer to format the string data into and read it.
|
||||
LPWSTR szBuffer = sNameString.GetBuffer(dwSize);
|
||||
if (!szBuffer) return ERROR_OUTOFMEMORY;
|
||||
dwSize = ::CertGetNameStringW(pCertContext, dwType, dwFlags, pvTypePara, szBuffer, dwSize);
|
||||
sNameString.ReleaseBuffer(dwSize);
|
||||
return dwSize;
|
||||
}
|
||||
|
||||
|
||||
namespace MSICA {
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -19,6 +19,10 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "MSICALib.h"
|
||||
|
||||
#include "../../../lib/atl/atlcrypt.h"
|
||||
|
||||
#include <atlbase.h>
|
||||
#include <atlfile.h>
|
||||
#include <atlstr.h>
|
||||
@ -28,5 +32,3 @@
|
||||
#include <mstask.h>
|
||||
#include <taskschd.h>
|
||||
#include <wlanapi.h>
|
||||
|
||||
#include "MSICALib.h"
|
||||
|
Loading…
x
Reference in New Issue
Block a user