__foldwin32sstuff __foldwin32sstuff;
foldstyleinitialization = true;


enablemapdirect3216 = true;
flatthunks          = true;

#include "types.thk"


VOID FreeCB(WORD wSel);

VOID UTProcessExit(WORD hUTState);

BOOL UTRegisterInt(DWORD hInst32,
                   LPSTR lpszDll16,
                   LPSTR lpszInitFunc,
                   LPSTR lpszThunkFunc,
                   LPDWORD ppfnThunk32Func,
                   DWORD Callback,
                   DWORD lpvData,
                   DWORD pfnAllocLSCallback,
                   DWORD pfnUTLSThkTemplate)
{
}


VOID UTUnregisterInt(DWORD hInst32, 
                     DWORD pfnFreeLSCallback);

DWORD UTThunkLSHelper(DWORD lp16Target, DWORD lpvParam, DWORD dwParam, LPVOID lpTransList);



VOID SSChk(VOID);


VOID FreeLibrary16ByName(LPSTR);


// Special yield for thread 1 during termination
VOID Yield16(VOID)
{}


//// We will not thunk any pointers here. It's more efficient to access them
//// flatly from the 16-bit side.
//BOOL WOWCallback16ExHelper(DWORD vmpfn16, DWORD cbArgs, DWORD pArgs, DWORD pdwRetCode);

//// Daytona Generic Thunk api.
//DWORD WOWCallback16(DWORD pfn16, DWORD dwParam)
//{
//      target = Callback8;
//}

// WOW NT Yield functions.
VOID    WOWYield16(VOID)
{
        target = Yield;
}

VOID    WOWDirectedYield16(WORD hTask16)
{
        target = DirectedYield;
}

// WOW NT global memory management
WORD    WOWGlobalAlloc16(WORD wFlags, DWORD cb);


WORD    WOWGlobalFree16(WORD hMem)  // Yes, we do not thunk the return pointer.
{
        target = GlobalFree;
}

DWORD   WOWGlobalLock16(WORD hMem)
{
        target = GlobalLock;
}

BOOL    WOWGlobalUnlock16(WORD hMem)
{
        target = GlobalUnlock;
}


DWORD WOWGlobalAllocLock16(WORD wFlags, DWORD cb, WORD *phMem);
WORD  WOWGlobalUnlockFree16(DWORD vpMem);
DWORD WOWGlobalLockSize16(WORD hMem, DWORD *pcb);



// Has to be INT to accomodate -1 error return
INT  TCD_Enum(WORD hModule, LPVOID lpBuffer, UINT wLimit);


VOID TCD_UnregisterPDB32(DWORD pdb32);


UINT FakeThunkTheTemplateHandle(DWORD lp32Template);



 WORD GrowMBABlock(WORD gHnd, DWORD dwNewHalfSize, DWORD dwOldHalfSize, WORD hModule) =
DWORD GrowMBABlock(WORD gHnd, DWORD dwNewHalfSize, DWORD dwOldHalfSize, WORD hModule) 
{
        faulterrorcode = 0;
}


DWORD SegCommonThunkAttach32(LPSTR pszDll16,
                             LPSTR pszDll32,
                             LPSTR lpThunkLSData32,
                             LPSTR pszThunkLSData16Name) =
DWORD SegCommonThunkAttach32(LPSTR pszDll16,
                             LPSTR pszDll32,
                             LPSTR lpThunkLSData32,
                             LPSTR pszThunkLSData16Name) 
{
        faulterrorcode = 0;
}


VOID SegCommonThunkDetach32(LPSTR pszDll16,
                            LPSTR pszDll32) =
VOID SegCommonThunkDetach32(LPSTR pszDll16,
                            LPSTR pszDll32)
{
        faulterrorcode = 0;
}


/* Internal routine for consistency-checking the handle group manager's
 * data structures.
 */
void CheckHGHeap() =
void CheckHGHeap() 
{
        faulterrorcode = 0;
}

/* Internal routine for nuking a handle group.
 */
void GlobalNukeGroup(WORD wGroup) =
void GlobalNukeGroup(WORD wGroup) 
{
        faulterrorcode = 0;
}


void GlobalFix(   UINT sel) =
void GlobalFix16( UINT sel)
{
        faulterrorcode = 0;
}

void GlobalUnfix( UINT sel) =
void GlobalUnfix16( UINT sel)
{
        faulterrorcode = 0;
}

void GlobalWire(   UINT sel) =
void GlobalWire16( UINT sel)
{
        faulterrorcode = 0;
}

void GlobalUnWire(   UINT sel) =
void GlobalUnWire16( UINT sel)
{
        faulterrorcode = 0;
}

UINT LoadLibrary16( LPSTR pszModName)
{
        faulterrorcode = 0;
}

void FreeLibrary(   UINT hInst) =
void FreeLibrary16( UINT hInst)
{
        faulterrorcode = 0;
}

/*
 * ThkGetProcAddress calls GetProcAddress and then touches the
 * entry point so it gets faulted in from 16-bit code.
 */
DWORD ThkGetProcAddress( UINT hInst, LPSTR pszProcName) =
DWORD GetProcAddress16(  UINT hInst, LPSTR pszProcName)
{
        faulterrorcode = 0;
}

UINT ThunkInitLSWorker16( UINT sel);

UINT IFreeSelector(  UINT sel) =
UINT FreeSelector16( UINT sel)
{
        faulterrorcode = 0;
}

DWORD ThkInitWin32Task() =
DWORD ThkInitWin32Task()
{
        faulterrorcode = 0;
}


UINT ThkCreateTask( UINT selPSP, DWORD pTDB, UINT selTib) =
UINT ThkCreateTask( UINT selPSP, DWORD pTDB, UINT selTib)
{
        faulterrorcode = 0;
}

UINT ThkDeleteTask( UINT hTaskK16) =
UINT ThkDeleteTask( UINT hTaskK16)
{
        faulterrorcode = 0;
}

VOID SetTaskName16(WORD htask, LPSTR lpstr) =
VOID SetTaskName16(DWORD htask, LPSTR lpstr)
{
}

LPSTR GetTaskName16(WORD htask, LPSTR lpstr) =
LPSTR GetTaskName16(DWORD htask, LPSTR lpstr)
{
        faulterrorcode = 0;
}

LPSTR GetModuleName16(WORD cs, LPSTR lpstr, LPWORD lpwSegNum) =
LPSTR GetModuleName16(DWORD cs, LPSTR lpstr, LPWORD lpwSegNum)
{
        faulterrorcode = 0;
}



DWORD GetWinFlags( ) =
DWORD GetWinFlags( )
{
        faulterrorcode = 0;
}

 WORD GetProductName(LPSTR,  WORD) =
DWORD GetProductName(LPSTR, DWORD)
{
}


 WORD        GetModuleFileName( WORD, LPSTR,  WORD) =
DWORD PrivateGetModuleFileName(DWORD, LPSTR, DWORD)
{
        faulterrorcode = 0;
}





WORD
WinExecEnv(
    LPSTR lpCmdLine,
    WORD nCmdShow,
    WORD wSegEnv
    )
{
        faulterrorcode = 0;
}


HANDLE    GlobalAlloc(UINT dwFlags, DWORD dwBytes) =
HANDLE  GlobalAlloc16(UINT dwFlags, DWORD dwBytes)
{
        faulterrorcode = 0;
}

HANDLE    GlobalReAlloc(HANDLE hMem, DWORD dwBytes, UINT dwFlags) =
HANDLE  GlobalReAlloc16(HANDLE hMem, DWORD dwBytes, UINT dwFlags)
{
        faulterrorcode = 0;
}

HANDLE   GlobalFree( HANDLE hMem) =
HANDLE GlobalFree16( HANDLE hMem)
{
        faulterrorcode = 0;
}

BOOL    GlobalUnlock( HANDLE hMem) =
BOOL  GlobalUnlock16( HANDLE hMem)
{
        faulterrorcode = 0;
}

UINT    GlobalFlags( HANDLE hMem) =
UINT  GlobalFlags16( HANDLE hMem)
{
        faulterrorcode = 0;
}

DWORD    GlobalSize( HANDLE hMem) =
DWORD  GlobalSize16( HANDLE hMem)
{
        faulterrorcode = 0;
}

HANDLE   GlobalHandle( UINT sel ) =
HANDLE   GlobalHandle16( UINT sel )
{
        faulterrorcode = 0;
}


/*  Profile apis */

/* BUGBUG [KevinR] 12-Mar-1993
 * Win32s implements natively in combo\base.c
 * We should follow suit?
 */

/* We thunk to IGetProfileString to skip the k16 validation layer.
 * This is because Win32 GetProfileString allows a NULL lpAppName case 
 * that Win16 doesn't.
 */
WORD IGetProfileString(LPSTR lpAppName, LPSTR lpKeyName, LPSTR lpDefault, LPSTR lpReturnedString, WORD nSize) =
DWORD GetProfileStringA(LPSTR lpAppName, LPSTR lpKeyName, LPSTR lpDefault, LPSTR lpReturnedString, DWORD nSize)
{
        faulterrorcode = 0;
}

BOOL WriteProfileString(LPSTR lpAppName, LPSTR lpKeyName, LPSTR lpString) =
BOOL WriteProfileStringA(LPSTR lpAppName, LPSTR lpKeyName, LPSTR lpString)
{
        faulterrorcode = 0;
}


/* We thunk to IGetPrivateProfileString to skip the k16 validation layer.
 * This is because Win32 GetPrivateProfileString allows a NULL lpAppName case 
 * that Win16 doesn't.
 */
WORD IGetPrivateProfileString(LPSTR lpAppName, LPSTR lpKeyName, LPSTR lpDefault, LPSTR lpReturnedString, WORD nSize, LPSTR lpFile) =
DWORD GetPrivateProfileString32A(LPSTR lpAppName, LPSTR lpKeyName, LPSTR lpDefault, LPSTR lpReturnedString, DWORD nSize, LPSTR lpFile)
{
        faulterrorcode = 0;
}

BOOL WritePrivateProfileString(LPSTR lpAppName, LPSTR lpKeyName, LPSTR lpString, LPSTR lpFile) =
BOOL WritePrivateProfileString32A(LPSTR lpAppName, LPSTR lpKeyName, LPSTR lpString, LPSTR lpFile)
{
        faulterrorcode = 0;
}

UINT GetPrivateProfileSection(LPSTR lpszSection, LPSTR lpszReturnBuffer, UINT cchBuffer, LPSTR lpszFile) =
DWORD GetPrivateProfileSection32A(LPSTR lpszSection, LPSTR lpszReturnBuffer, DWORD cchBuffer, LPSTR lpszFile)
{
        faulterrorcode = 0;
}

BOOL WritePrivateProfileSection(LPSTR lpszSection, LPSTR lpszReturnBuffer, LPSTR lpszFile) =
BOOL WritePrivateProfileSection32A(LPSTR lpszSection, LPSTR lpszReturnBuffer, LPSTR lpszFile)
{
        faulterrorcode = 0;
}

UINT GetProfileSection(LPSTR lpszSection, LPSTR lpszReturnBuffer, UINT cchBuffer) =
DWORD GetProfileSectionA(LPSTR lpszSection, LPSTR lpszReturnBuffer, DWORD cchBuffer)
{
        faulterrorcode = 0;
}

BOOL WriteProfileSection(LPSTR lpszSection, LPSTR lpszReturnBuffer ) =
BOOL WriteProfileSectionA(LPSTR lpszSection, LPSTR lpszReturnBuffer )
{
        faulterrorcode = 0;
}


/* Yes, I double-checked k16. The return type *is* BOOL. */
BOOL GetPrivateProfileStruct(LPSTR lpszSection, LPSTR szKey, LPSTR lpStruct, UINT uSizeStruct, LPSTR szFile) =
BOOL GetPrivateProfileStruct32A(LPSTR lpszSection, LPSTR szKey, LPSTR lpStruct, UINT uSizeStruct, LPSTR szFile) 
{
  szFile = passifhinull;
  faulterrorcode = 0;
}

BOOL WritePrivateProfileStruct(LPSTR lpszSection, LPSTR szKey, LPSTR lpStruct, UINT wSizeStruct, LPSTR szFile) =
BOOL WritePrivateProfileStruct32A(LPSTR lpszSection, LPSTR szKey, LPSTR lpStruct, UINT wSizeStruct, LPSTR szFile) 
{
  lpStruct = passifhinull;
  szFile   = passifhinull;
  faulterrorcode = 0;
}



WORD GetPrivateProfileSectionNames(LPSTR lpszReturnBuffer, UINT cchBuffer, LPSTR lpszFile) =
DWORD GetPrivateProfileSectionNames32A(LPSTR lpszReturnBuffer, DWORD cchBuffer, LPSTR lpszFile)
{
        faulterrorcode = 0;
}


/*
 * global atom apis
 */

WORD  GlobalAddAtom( LPSTR lpsz) =
DWORD GlobalAddAtomA( LPSTR lpsz)
{
        faulterrorcode = 0;
}

WORD  GlobalFindAtom( LPSTR lpsz) =
DWORD GlobalFindAtomA( LPSTR lpsz)
{
        faulterrorcode = 0;
}

WORD  GlobalDeleteAtom( WORD atom) =
DWORD GlobalDeleteAtom( DWORD atom)
{
        faulterrorcode = 0;
}

WORD  GlobalGetAtomName( WORD atom, LPSTR lpBuff, WORD cbSize) =
DWORD GlobalGetAtomNameA( DWORD atom, LPSTR lpBuff, DWORD cbSize)
{
        faulterrorcode = 0;
}


/*
 * Directory APIs
 */

WORD GetWindowsDirectory(LPSTR lpBuffer, WORD nSize) =
DWORD GetWindowsDirectoryA(LPSTR lpBuffer, DWORD nSize)
{
        faulterrorcode = 0;
}

WORD GetSystemDirectory(LPSTR lpBuffer, WORD nSize) =
DWORD GetSystemDirectoryA(LPSTR lpBuffer, DWORD nSize)
{
        faulterrorcode = 0;
}

UINT    SetErrorMode16(UINT fuErrorMode) =
UINT    SetErrorMode16(UINT fuErrorMode)
{
        faulterrorcode = 0;
}

WORD    GetErrorMode() =
DWORD   GetErrorMode()
{
        faulterrorcode = 0;
}

SHORT OpenFile(LPSTR lpFileName, LPSTR lpReOpenBuff, WORD wStyle)=
LONG ThkOpenFile(LPSTR lpFileName, LPSTR lpReOpenBuff, DWORD wStyle)
{
        faulterrorcode = 0;
}



BOOL ExecConsoleAgent() =
BOOL ExecConsoleAgent()
{
        faulterrorcode = 0;
}





BOOL IsDriveCDRom(WORD wDriveNum) =
BOOL IsDriveCDRom(WORD wDriveNum)
{
        faulterrorcode = 0;
}


LPSTR    GlobalLock( HANDLE hMem) =
LPSTR  GlobalLock16( HANDLE hMem)
{
        faulterrorcode = 0;
}




WORD  Win32AddAtom( LPSTR lpsz) =
DWORD AddAtomA( LPSTR lpsz)
{
        faulterrorcode = 0;
}

WORD  Win32FindAtom( LPSTR lpsz) =
DWORD FindAtomA( LPSTR lpsz)
{
        faulterrorcode = 0;
}

WORD  Win32DeleteAtom( WORD atom) =
DWORD DeleteAtom( DWORD atom)
{
        faulterrorcode = 0;
}

WORD  Win32GetAtomName( WORD atom, LPSTR lpBuff, WORD cbSize) =
DWORD GetAtomNameA( DWORD atom, LPSTR lpBuff, DWORD cbSize)
{
        faulterrorcode = 0;
}

BOOL Win32InitAtomTable(WORD cTableEntries) =
BOOL InitAtomTable(DWORD cTableEntries)
{
        faulterrorcode = 0;
}

DWORD CommConfigThk( DWORD dwId, LPSTR pszLibName, LPSTR pszProcName,
                    LPSTR pszFriendlyDeviceName, LPSTR pCommConfig,
                    LPSTR pdwSize, DWORD dwSizeOrHwnd) =
DWORD CommConfigThk( DWORD dwId, LPSTR pszLibName, LPSTR pszProcName,
                    LPSTR pszFriendlyDeviceName, LPSTR pCommConfig,
                    LPSTR pdwSize, DWORD dwSizeOrHwnd)
{
        faulterrorcode = 0;
}

VOID PK16FNF(PVOID) 
{}

BOOL SetVolumeLabel(  LPSTR pszRootPathName, LPSTR pszVolumeName) =
BOOL SetVolumeLabel16( LPSTR pszRootPathName, LPSTR pszVolumeName)
{
        faulterrorcode = 0;
}

BOOL GetFastQueue() =
BOOL GetFastQueue()
{
        faulterrorcode = 0;
}

VOID DispatchRITInput() =
VOID DispatchRITInput() 
{
        faulterrorcode = 0;
}

VOID DiagOutput( LPSTR psz ) =
VOID DiagOutput16( LPSTR psz )
{
        faulterrorcode = 0;
}

VOID TerminateZombie( WORD wpspsel ) =
VOID TerminateZombie( WORD wpspsel )
{
}