//+---------------------------------------------------------------------------
//
//  Microsoft Windows NT5.0
//  Copyright (C) Microsoft Corporation, 1997.
//
//  File:       O E M U P G E X . H
//
//  Contents:   Function prototypes needed for OEM network upgrade
//
//  Notes:
//
//  Author:     kumarp    16-October-97
//
//----------------------------------------------------------------------------

#pragma once

// ---------------------------------------------------------------------------

//#ifndef WINNT32P_H
typedef enum {   
    UNKNOWN,
    NT_WORKSTATION,
    NT_SERVER
} PRODUCTTYPE;
//#endif

typedef struct ProductInfo
{
    PRODUCTTYPE ProductType;
    DWORD       dwBuildNumber;
} PRODUCTINFO;

typedef struct NetUpgradeInfoTag
{
    PRODUCTINFO From;
    PRODUCTINFO To;
} NetUpgradeInfo;

// ---------------------------------------------------------------------------

typedef struct
{
    TCHAR   szCompanyName[256];
    TCHAR   szSupportNumber[256];
    TCHAR   szSupportUrl[256];
    TCHAR   szInstructionsToUser[1024];
} VENDORINFO;

const DWORD c_dwMaxProductIdLen = 255;

const DWORD NUA_LOAD_POST_UPGRADE     = 0x0001;
const DWORD NUA_REQUEST_ABORT_UPGRADE = 0x0002;


// ---------------------------------------------------------------------------
// Names of functions exported from OEM DLL
//
extern const char c_szPreUpgradeInitialize[];
extern const char c_szDoPreUpgradeProcessing[];
extern const char c_szPostUpgradeInitialize[];
extern const char c_szDoPostUpgradeProcessing[];

// ---------------------------------------------------------------------------
// Names of functions exported from netupgrd.dll
//
extern const char c_szNetUpgradeAddSection[];
extern const char c_szNetUpgradeAddLineToSection[];

// ---------------------------------------------------------------------------
// Keys in OemSection
//
extern const TCHAR c_szInfToRunBeforeInstall[];
extern const TCHAR c_szInfToRunAfterInstall[];

// ===========================================================================
//
// Prototypes for functions exported from OEM DLL
//
// ===========================================================================

//+---------------------------------------------------------------------------
//
//  Function:   PreUpgradeInitialize
//
//  Purpose:    Intialize OEM DLL
//
//  Arguments:
//      szWorkingDir     [in]   name of temporary directory to be used
//      pNetUpgradeInfo  [in]   pointer to NetUpgradeInfo structure
//      szProductId      [out]  Description of component being upgraded 
//      pviVendorInfo    [out]  information about OEM
//      pvReserved       [out]  reserved
//
//  Returns:    ERROR_SUCCESS in case of success, win32 error otherwise
//
//  Author:     kumarp    16-October-97
//
//  Notes:
//      This function is called before any other function in this dll. 
//      The main purpose of calling this function is to obtain
//      identification information and to allow the DLL to initialize 
//      its internal data
//
EXTERN_C LONG __declspec(dllexport) __stdcall
PreUpgradeInitialize(IN  LPCTSTR         szWorkingDir,
                     IN  NetUpgradeInfo* pNetUpgradeInfo,
                     //OUT LPCTSTR*        szProductId,
                     OUT VENDORINFO*     pviVendorInfo,
                     OUT DWORD*          pdwFlags,
                     OUT LPVOID          pvReserved);

typedef LONG __declspec(dllexport)
(__stdcall *PreUpgradeInitializePrototype)
     (IN  LPCTSTR         szWorkingDir,
      IN  NetUpgradeInfo* pNetUpgradeInfo,
      //OUT LPCTSTR*        szProductId,
      OUT VENDORINFO*     pviVendorInfo,
      OUT DWORD*          pdwFlags,
      OUT LPVOID          pvReserved);

//+---------------------------------------------------------------------------
//
//  Function:   DoPreUpgradeProcessing
//
//  Purpose:    Intialize OEM DLL
//
//  Arguments:
//      hParentWindow    [in]  window handle for showing UI 
//      hkeyParams       [in]  handle to parameters key in registry
//      szPreNT5InfId    [in]  pre-NT5 InfID
//      szPreNT5Instance [in]  pre-NT5 instance name
//      szNT5InfId       [in]  NT5 InfId
//      szSectionName    [in]  section name to be used for writing info
//      dwFlags          [out] flags
//      pvReserve        [in]  reserved
//
//  Returns:    ERROR_SUCCESS in case of success, win32 error otherwise
//
//  Author:     kumarp    16-October-97
//
//  Notes:
//      This function is called once per component to be upgraded.
//
EXTERN_C LONG __declspec(dllexport) __stdcall
DoPreUpgradeProcessing(IN   HWND        hParentWindow,
                       IN   HKEY        hkeyParams,
                       IN   LPCTSTR     szPreNT5InfId,
                       IN   LPCTSTR     szPreNT5Instance,
                       IN   LPCTSTR     szNT5InfId,
                       IN   LPCTSTR     szSectionName,
                       OUT  VENDORINFO* pviVendorInfo,
                       OUT  DWORD*      pdwFlags,
                       IN   LPVOID      pvReserved);

typedef LONG __declspec(dllexport) 
(__stdcall *DoPreUpgradeProcessingPrototype)
     (IN   HWND    hParentWindow,
      IN   HKEY    hkeyParams,
      IN   LPCTSTR szPreNT5InfId,
      IN   LPCTSTR szPreNT5Instance,
      IN   LPCTSTR szNT5InfId,
      IN   LPCTSTR szSectionName,
      OUT  VENDORINFO* pviVendorInfo,
      OUT  DWORD*  pdwFlags,
      IN   LPVOID  pvReserved);


//+---------------------------------------------------------------------------
//
//  Function:   PostUpgradeInitialize
//
//  Purpose:    Intialize OEM DLL during GUI mode setup
//
//  Arguments:
//      szWorkingDir     [in]   name of temporary directory to be used
//      pNetUpgradeInfo  [in]   pointer to NetUpgradeInfo structure
//      szProductId      [out]  Description of component being upgraded 
//      pviVendorInfo    [out]  information about OEM
//      pvReserved       [out]  reserved
//
//  Returns:    ERROR_SUCCESS in case of success, win32 error otherwise
//
//  Author:     kumarp    16-October-97
//
//  Notes:
//      This function is called in GUI mode setup before
//      any other function in this dll . 
//      The main purpose of calling this function is to obtain
//      identification information and to allow the DLL to initialize 
//      its internal data
//
EXTERN_C LONG __declspec(dllexport) __stdcall
PostUpgradeInitialize(IN LPCTSTR          szWorkingDir,
                      IN  NetUpgradeInfo* pNetUpgradeInfo,
                      //OUT LPCTSTR*        szProductId,
                      OUT VENDORINFO*     pviVendorInfo,
                      OUT LPVOID          pvReserved);

typedef LONG __declspec(dllexport) 
(__stdcall *PostUpgradeInitializePrototype)
     (IN LPCTSTR          szWorkingDir,
      IN  NetUpgradeInfo* pNetUpgradeInfo,
      //OUT LPCTSTR*        szProductId,
      OUT VENDORINFO*     pviVendorInfo,
      OUT LPVOID          pvReserved);



//+---------------------------------------------------------------------------
//
//  Function:   DoPostUpgradeProcessing
//
//  Purpose:    Intialize OEM DLL
//
//  Arguments:
//      hParentWindow    [in]  window handle for showing UI 
//      hkeyParams       [in]  handle to parameters key in registry
//      szPreNT5InfId    [in]  pre-NT5 InfID
//      szPreNT5Instance [in]  pre-NT5 instance name
//      szNT5InfId       [in]  NT5 InfId
//      hinfAnswerFile   [in]  handle to answer-file
//      szSectionName    [in]  name of section having component parameters 
//      pvReserve        [in]  reserved
//
//  Returns:    ERROR_SUCCESS in case of success, win32 error otherwise
//
//  Author:     kumarp    16-October-97
//
//  Notes:
//      This function is called once per component upgraded.
//
EXTERN_C LONG __declspec(dllexport) __stdcall
DoPostUpgradeProcessing(IN  HWND    hParentWindow,
                        IN  HKEY    hkeyParams,
                        IN  LPCTSTR szPreNT5Instance,
                        IN  LPCTSTR szNT5InfId,
                        IN  HINF    hinfAnswerFile,
                        IN  LPCTSTR szSectionName,
                        OUT VENDORINFO* pviVendorInfo,
                        IN  LPVOID  pvReserved);

typedef LONG __declspec(dllexport) 
(__stdcall *DoPostUpgradeProcessingPrototype)
     (IN  HWND    hParentWindow,
      IN  HKEY    hkeyParams,
      IN  LPCTSTR szPreNT5Instance,
      IN  LPCTSTR szNT5InfId,
      IN  HINF    hinfAnswerFile,
      IN  LPCTSTR szSectionName,
      OUT VENDORINFO* pviVendorInfo,
      IN  LPVOID  pvReserved);


// ===========================================================================
//
// Prototypes for functions exported by netupgrd.dll
//
// ===========================================================================

EXTERN_C LONG __declspec(dllexport) __stdcall
NetUpgradeAddSection(IN LPCTSTR szSectionName);

typedef LONG __declspec(dllexport)
(__stdcall *NetUpgradeAddSectionPrototype) (IN LPCTSTR szSectionName);


EXTERN_C LONG __declspec(dllexport) __stdcall
NetUpgradeAddLineToSection(IN LPCTSTR szSectionName,
                           IN LPCTSTR szLine);

typedef LONG __declspec(dllexport)
(__stdcall *NetUpgradeAddLineToSectionPrototype) (IN LPCTSTR szSectionName,
                                                  IN LPCTSTR szLine);

