Example #1
0
/**********************************************************************
 *      DirectResAlloc    (KERNEL.168)
 *
 * Check Schulman, p. 232 for details
 */
HGLOBAL16 WINAPI DirectResAlloc16( HINSTANCE16 hInstance, WORD wType,
                                 UINT16 wSize )
{
    HGLOBAL16 ret;
    TRACE("(%04x,%04x,%04x)\n", hInstance, wType, wSize );
    if (!(hInstance = GetExePtr( hInstance ))) return 0;
    if(wType != 0x10)	/* 0x10 is the only observed value, passed from
                           CreateCursorIndirect. */
        TRACE("(wType=%x)\n", wType);
    ret = GlobalAlloc16( GMEM_MOVEABLE, wSize );
    if (ret) FarSetOwner16( ret, hInstance );
    return ret;
}
Example #2
0
BOOL GetModuleExpWinVer(HMODULE hModule, LPWORD pwVer)
{
    hModule = GetExePtr(hModule);
    LPBYTE pMDB = LPBYTE(MAKELP(hModule, 0));
    if (!BAD_PTR(pMDB, 0x40) &&
        pMDB[0x00] == 'N' && pMDB[0x01] == 'E' &&
        (pMDB[0x0c] & 0x10) == 0x00) // !Win32 module
    {
        *pwVer = MAKEWORD(pMDB[0x3e], pMDB[0x3f]);
        return (TRUE);
    }
    return (FALSE);
}
Example #3
0
BOOL SetModuleExpWinVer(HMODULE hModule, WORD wVer)
{
    hModule = GetExePtr(hModule);
    LPBYTE pMDB = LPBYTE(MAKELP(hModule, 0));
    if (!BAD_PTR(pMDB, 0x40) &&
        pMDB[0x00] == 'N' && pMDB[0x01] == 'E' &&
        (pMDB[0x0c] & 0x10) == 0x00) // !Win32 module
    {
        pMDB[0x3e] = LOBYTE(wVer); // minor
        pMDB[0x3f] = HIBYTE(wVer); // major
        return (TRUE);
    }
    return (FALSE);
}
Example #4
0
/***********************************************************************
 *           _DebugOutput                    (KERNEL.328)
 */
void WINAPIV _DebugOutput( WORD flags, LPCSTR spec, VA_LIST16 valist )
{
    char caller[101];

    /* Decode caller address */
    if (!GetModuleName16( GetExePtr(CURRENT_STACK16->cs), caller, sizeof(caller) ))
        sprintf( caller, "%04X:%04X", CURRENT_STACK16->cs, CURRENT_STACK16->ip );

    /* FIXME: cannot use wvsnprintf16 from kernel */
    /* wvsnprintf16( temp, sizeof(temp), spec, valist ); */

    /* Output */
    FIXME("%s %04x %s\n", caller, flags, debugstr_a(spec) );
}