Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

252 lines
10 KiB

/*++
Copyright (c) 1998-1999, Microsoft Corporation
Module Name:
PIDGen.h
Abstract:
public header
--*/
#ifdef __cplusplus
extern "C" {
#endif
#if defined(WIN32) || defined(_WIN32)
#ifdef UNICODE
#define PIDGen PIDGenW
#define PIDGenSimp PIDGenSimpW
#define PIDGenEx PIDGenExW
#else
#define PIDGen PIDGenA
#define PIDGenSimp PIDGenSimpA
#define PIDGenEx PIDGenExA
#endif // UNICODE
#else
#include <string.h>
#include <compobj.h>
typedef BOOL NEAR *PBOOL;
typedef BOOL FAR *LPBOOL;
typedef FILETIME FAR *LPFILETIME;
#define PIDGenA PIDGen
#define PIDGenExA PIDGenEx
#define lstrlenA lstrlen
#define lstrcpyA lstrcpy
#define wsprintfA wsprintf
#define TEXT(s) __T(s)
#define ZeroMemory(pb, cb) memset(pb, 0, cb)
#define CopyMemory(pb, ab, cb) memcpy(pb, ab, cb)
#endif // defined(WIN32) || defined(_WIN32)
#define DIGITALPIDMAXLEN 256 // Max length of digital PID 3.0 data blob
#define INVALID_PID 0xFFFFFFFF
// PidGenSimp error code values
enum PidGenError { // pge
// Call succeded
pgeSuccess = 0,
// Unable to validate product key. Most likely causes:
// * Product Key was mistyped by user
// * Product Key not compatable with this .dll (wrong GroupId)
pgeProductKeyInvalid = 1,
// Product Key's sequence number is not allowed by this .dll.
// Most likely causes:
// * Using Select or MSDN key with a PidGen/PidCa
// that specifically excludes them
pgeProductKeyExcluded = 2,
// NULL was passed in for the required Product Key. (Must
// point to valid Product key.)
pgeProductKeyNull = 3,
// Product Key is wrong length. After removing any dashes, the length
// is required to be 25 characters
pgeProductKeyBadLen = 4,
// NULL was passed in for the required SKU. (Must point to
// valid SKU.)
pgeSkuNull = 5,
// SKU is wrong length (too long).
pgeSkuBadLen = 6,
// NULL was passed in for the required PID2. (Must
// point to buffer for return PID.)
pgePid2Null = 7,
// NULL was passed in for the required DigPid. (Must
// point to buffer for generated DigitalPID.)
pgeDigPidNull = 8,
// DigPid is wrong length (too small).
pgeDigPidBadLen = 9,
// NULL was passed in for the required MPC.
pgeMpcNull = 10,
// MPC is wrong length. Must be exactly 5 characters.
pgeMpcBadLen = 11,
// OemId is bad. If passed (it's not required) it must
// be 4 characters.
pgeOemIdBadLen = 12,
// Local char set is bad. If provided, must be 24 characters.
pgeLocalBad = 13,
// ProductKey Unicode conversion failed
pgeProductKeyBadUnicode = 14,
// Mpc Unicode conversion failed
pgeMpcBadUnicode = 15,
// SKU Unicode conversion failed
pgeSkuBadUnicode = 16,
// OemId Unicode conversion failed
pgeOemIdBadUnicode = 17,
// Local Unicode conversion failed
pgeLocalBadUnicode = 18,
// Pid2 Unicode conversion failed
pgePid2BadUnicode = 19,
};
// Original, outdated, interface to PidGen
BOOL STDAPICALLTYPE PIDGenA(
LPSTR lpstrSecureCdKey, // [IN] 25-character Secure CD-Key (gets U-Cased)
LPCSTR lpstrMpc, // [IN] 5-character Microsoft Product Code
LPCSTR lpstrSku, // [IN] Stock Keeping Unit (formatted like 123-12345)
LPCSTR lpstrOemId, // [IN] 4-character OEM ID or NULL
LPSTR lpstrLocal24, // [IN] 24-character ordered set to use for decode base conversion or NULL for default set (gets U-Cased)
LPBYTE lpbPublicKey, // [IN] pointer to optional public key or NULL
DWORD dwcbPublicKey, // [IN] byte length of optional public key
DWORD dwKeyIdx, // [IN] key pair index optional public key
BOOL fOem, // [IN] is this an OEM install?
LPSTR lpstrPid2, // [OUT] PID 2.0, pass in ptr to 24 character array
LPBYTE lpbDigPid, // [IN/OUT] pointer to DigitalPID buffer. First DWORD is the length
LPDWORD lpdwSeq, // [OUT] optional ptr to sequence number (can be NULL)
LPBOOL pfCCP, // [OUT] optional ptr to Compliance Checking flag (can be NULL)
LPBOOL pfPSS); // [OUT] optional ptr to 'PSS Assigned' flag (can be NULL)
// Simplified interface to PidGen
DWORD STDAPICALLTYPE PIDGenSimpA(
LPSTR lpstrSecureCdKey, // [IN] 25-character Secure CD-Key (gets U-Cased)
LPCSTR lpstrMpc, // [IN] 5-character Microsoft Product Code
LPCSTR lpstrSku, // [IN] Stock Keeping Unit (formatted like 123-12345)
LPCSTR lpstrOemId, // [IN] 4-character OEM ID or NULL
BOOL fOem, // [IN] is this an OEM install?
LPSTR lpstrPid2, // [OUT] PID 2.0, pass in ptr to 24 character array
LPBYTE lpbDigPid, // [IN/OUT] pointer to DigitalPID buffer. First DWORD is the length
LPDWORD lpdwSeq, // [OUT] optional ptr to sequence number or NULL
LPBOOL pfCCP); // [OUT] ptr to Compliance Checking flag or NULL
// New interfaces added for VL check
BOOL STDAPICALLTYPE PIDGenExA(
LPSTR lpstrSecureCdKey, // [IN] 25-character Secure CD-Key (gets U-Cased)
LPCSTR lpstrMpc, // [IN] 5-character Microsoft Product Code
LPCSTR lpstrSku, // [IN] Stock Keeping Unit (formatted like 123-12345)
LPCSTR lpstrOemId, // [IN] 4-character OEM ID or NULL
LPSTR lpstrLocal24, // [IN] 24-character ordered set to use for decode base conversion or NULL for default set (gets U-Cased)
LPBYTE lpbPublicKey, // [IN] pointer to optional public key or NULL
DWORD dwcbPublicKey, // [IN] byte length of optional public key
DWORD dwKeyIdx, // [IN] key pair index optional public key
BOOL fOem, // [IN] is this an OEM install?
LPSTR lpstrPid2, // [OUT] PID 2.0, pass in ptr to 24 character array
LPBYTE lpbDigPid, // [IN/OUT] pointer to DigitalPID buffer. First DWORD is the length
LPDWORD lpdwSeq, // [OUT] optional ptr to sequence number (can be NULL)
LPBOOL pfCCP, // [OUT] optional ptr to Compliance Checking flag (can be NULL)
LPBOOL pfPSS, // [OUT] optional ptr to 'PSS Assigned' flag (can be NULL)
LPBOOL pfVL); // [OUT] optional ptr to Volume Licensing flag (can be NULL)
#if defined(WIN32) || defined(_WIN32)
// Original, outdated, interface to PidGen
BOOL STDAPICALLTYPE PIDGenW(
LPWSTR lpstrSecureCdKey, // [IN] 25-character Secure CD-Key (gets U-Cased)
LPCWSTR lpstrMpc, // [IN] 5-character Microsoft Product Code
LPCWSTR lpstrSku, // [IN] Stock Keeping Unit (formatted like 123-12345)
LPCWSTR lpstrOemId, // [IN] 4-character OEM ID or NULL
LPWSTR lpstrLocal24, // [IN] 24-character ordered set to use for decode base conversion or NULL for default set (gets U-Cased)
LPBYTE lpbPublicKey, // [IN] pointer to optional public key or NULL
DWORD dwcbPublicKey, // [IN] byte length of optional public key
DWORD dwKeyIdx, // [IN] key pair index optional public key
BOOL fOem, // [IN] is this an OEM install?
LPWSTR lpstrPid2, // [OUT] PID 2.0, pass in ptr to 24 character array
LPBYTE lpbDigPid, // [IN/OUT] pointer to DigitalPID buffer. First DWORD is the length
LPDWORD lpdwSeq, // [OUT] optional ptr to sequence number (can be NULL)
LPBOOL pfCCP, // [OUT] optional ptr to Compliance Checking flag (can be NULL)
LPBOOL pfPSS); // [OUT] optional ptr to 'PSS Assigned' flag (can be NULL)
// Simplified interface to PidGen
DWORD STDAPICALLTYPE PIDGenSimpW(
LPWSTR lpstrSecureCdKey, // [IN] 25-character Secure CD-Key (gets U-Cased)
LPCWSTR lpstrMpc, // [IN] 5-character Microsoft Product Code
LPCWSTR lpstrSku, // [IN] Stock Keeping Unit (formatted like 123-12345)
LPCWSTR lpstrOemId, // [IN] 4-character OEM ID or NULL
BOOL fOem, // [IN] is this an OEM install?
LPWSTR lpstrPid2, // [OUT] PID 2.0, pass in ptr to 24 character array
LPBYTE lpbDigPid, // [IN/OUT] pointer to DigitalPID buffer. First DWORD is the length
LPDWORD lpdwSeq, // [OUT] optional ptr to sequence number or NULL
LPBOOL pfCCP); // [OUT] ptr to Compliance Checking flag or NULL
BOOL STDAPICALLTYPE PIDGenExW(
LPWSTR lpstrSecureCdKey, // [IN] 25-character Secure CD-Key (gets U-Cased)
LPCWSTR lpstrMpc, // [IN] 5-character Microsoft Product Code
LPCWSTR lpstrSku, // [IN] Stock Keeping Unit (formatted like 123-12345)
LPCWSTR lpstrOemId, // [IN] 4-character OEM ID or NULL
LPWSTR lpstrLocal24, // [IN] 24-character ordered set to use for decode base conversion or NULL for default set (gets U-Cased)
LPBYTE lpbPublicKey, // [IN] pointer to optional public key or NULL
DWORD dwcbPublicKey, // [IN] byte length of optional public key
DWORD dwKeyIdx, // [IN] key pair index optional public key
BOOL fOem, // [IN] is this an OEM install?
LPWSTR lpstrPid2, // [OUT] PID 2.0, pass in ptr to 24 character array
LPBYTE lpbDigPid, // [IN/OUT] pointer to DigitalPID buffer. First DWORD is the length
LPDWORD lpdwSeq, // [OUT] optional ptr to sequence number (can be NULL)
LPBOOL pfCCP, // [OUT] optional ptr to Compliance Checking flag (can be NULL)
LPBOOL pfPSS, // [OUT] optional ptr to 'PSS Assigned' flag (can be NULL)
LPBOOL pfVL); // [OUT] optional ptr to Volume Licensing flag (can be NULL)
#endif // defined(WIN32) || defined(_WIN32)
extern HINSTANCE g_hinst;
#ifdef __cplusplus
} /* End of extern "C" { */
#endif /* __cplusplus */