-/* $Id: stubs.c,v 1.26 2001/03/31 01:17:29 dwelch Exp $
+/* $Id: stubs.c,v 1.33 2002/09/23 19:20:34 sedwards Exp $
*
* KERNEL32.DLL stubs (unimplemented functions)
* Remove from this file, if you implement them.
}
-
-
-
-
-
-
-
-
-
-
-
-
BOOL
STDCALL
CmdBatNotification (
}
-
-
-
int
STDCALL
CompareStringA (
}
-
LCID
STDCALL
ConvertDefaultLocale (
}
-
-
-
-
-
DWORD
STDCALL
CreateVirtualBuffer (
}
-
-
-
-
-
-
-
WINBOOL
STDCALL
EnumCalendarInfoW (
{
WCHAR Name [MAX_COMPUTERNAME_LENGTH + 1];
DWORD Size = 0;
-
+
/*
* FIXME: get the computer's name from
* the registry.
}
-
-
int
STDCALL
GetLocaleInfoW (
}
-
-
-
-
DWORD
STDCALL
GetNextVDMCommand (
}
-
-
-
UINT
STDCALL
GetOEMCP (VOID)
}
-
-
-
-
-
WINBOOL
STDCALL
GetStringTypeExW (
}
-
-
LCID
STDCALL
GetThreadLocale (VOID)
);
}
+WINBOOL
+STDCALL
+GetThreadPriorityBoost (
+ HANDLE hThread,
+ DWORD dwSelector,
+ LPLDT_ENTRY lpSelectorEntry
+ )
+{
+ SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+ return FALSE;
+}
WINBOOL
STDCALL
return 0;
}
-/*
-HGLOBAL
-STDCALL
-GlobalAlloc (
- UINT uFlags,
- DWORD dwBytes
- )
-{
- SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
- return 0;
-}
-*/
-
-UINT
-STDCALL
-GlobalCompact (
- DWORD dwMinFree
- )
-{
- SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
- return 0;
-}
-
-VOID
-STDCALL
-GlobalFix (
- HGLOBAL hMem
- )
-{
- SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-}
-
-
-UINT
-STDCALL
-GlobalFlags (
- HGLOBAL hMem
- )
-{
- SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
- return 0;
-}
-
-
-/*
-HGLOBAL
-STDCALL
-GlobalFree (
- HGLOBAL hMem
- )
-{
- SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
- return hMem;
-}
-*/
-
-HGLOBAL
-STDCALL
-GlobalHandle (
- LPCVOID pMem
- )
-{
- SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
- return 0;
-}
-
-
-LPVOID
-STDCALL
-GlobalLock (
- HGLOBAL hMem
- )
-{
- /* In Win32 GlobalAlloc returns LPVOID? */
- return hMem;
-}
-
-
-VOID
-STDCALL
-GlobalMemoryStatus (
- LPMEMORYSTATUS lpBuffer
- )
-{
- SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-}
-
-
-HGLOBAL
-STDCALL
-GlobalReAlloc (
- HGLOBAL hMem,
- DWORD dwBytes,
- UINT uFlags
- )
-{
- SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
- return 0;
-}
-
-/*
-DWORD
-STDCALL
-GlobalSize (
- HGLOBAL hMem
- )
-{
- SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
- return 0;
-}
-*/
-
-WINBOOL
-STDCALL
-GlobalUnWire (
- HGLOBAL hMem
- )
-{
- SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
- return FALSE;
-}
-
-
-VOID
-STDCALL
-GlobalUnfix (
- HGLOBAL hMem
- )
-{
- SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-}
-
-
-WINBOOL
-STDCALL
-GlobalUnlock (
- HGLOBAL hMem
- )
-{
- SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
- return FALSE;
-}
-
-
-LPVOID
-STDCALL
-GlobalWire (
- HGLOBAL hMem
- )
-{
- SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
- return NULL; /* ? */
-}
-
-
-DWORD
-STDCALL
-HeapCreateTagsW (
- DWORD Unknown0,
- DWORD Unknown1,
- DWORD Unknown2,
- DWORD Unknown3
- )
-{
- SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
- return 0;
-}
-
-
-DWORD
-STDCALL
-HeapExtend (
- DWORD Unknown0,
- DWORD Unknown1,
- DWORD Unknown2,
- DWORD Unknown3
- )
-{
- SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
- return 0;
-}
-
-
-DWORD
-STDCALL
-HeapQueryTagW (
- DWORD Unknown0,
- DWORD Unknown1,
- DWORD Unknown2,
- DWORD Unknown3,
- DWORD Unknown4
- )
-{
- SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
- return 0;
-}
-
-
-DWORD
-STDCALL
-HeapSummary (
- DWORD Unknown0,
- DWORD Unknown1,
- DWORD Unknown2
- )
-{
- SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
- return 0;
-}
-
-
-DWORD
-STDCALL
-HeapUsage (
- DWORD Unknown0,
- DWORD Unknown1,
- DWORD Unknown2,
- DWORD Unknown3,
- DWORD Unknown4
- )
-{
- SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
- return 0;
-}
-
WINBOOL
STDCALL
-HeapWalk (
- HANDLE hHeap,
- LPPROCESS_HEAP_ENTRY lpEntry
+IsDBCSLeadByte (
+ BYTE TestChar
)
{
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
}
-
-
WINBOOL
STDCALL
-IsDBCSLeadByte (
+IsDBCSLeadByteEx (
+ UINT CodePage,
BYTE TestChar
)
{
}
-WINBOOL
+/**********************************************************************
+ * NAME PRIVATE
+ * IsInstalledCP@4
+ *
+ * RETURN VALUE
+ * TRUE if CodePage is installed in the system.
+ */
+static
+BOOL
STDCALL
-IsDBCSLeadByteEx (
- UINT CodePage,
- BYTE TestChar
+IsInstalledCP (
+ UINT CodePage
)
{
- SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
- return FALSE;
+ /* FIXME */
+ return TRUE;
}
}
+/***********************************************************************
+ * MulDiv (KERNEL32.@)
+ * RETURNS
+ * Result of multiplication and division
+ * -1: Overflow occurred or Divisor was 0
+ */
-
-
-HLOCAL
-STDCALL
-LocalAlloc (
- UINT uFlags,
- UINT uBytes
- )
-{
- SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
- return 0;
-}
-
-
-UINT
-STDCALL
-LocalCompact (
- UINT uMinFree
- )
-{
- SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
- return 0;
-}
-
-
-UINT
-STDCALL
-LocalFlags (
- HLOCAL hMem
- )
-{
- SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
- return 0;
-}
-
-
-HLOCAL
-STDCALL
-LocalFree (
- HLOCAL hMem
- )
-{
- SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
- return hMem;
-}
-
-
-HLOCAL
-STDCALL
-LocalHandle (
- LPCVOID pMem
- )
-{
- SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
- return 0;
-}
-
-
-LPVOID
-STDCALL
-LocalLock (
- HLOCAL hMem
- )
-{
- SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
- return NULL;
-}
-
-
-HLOCAL
-STDCALL
-LocalReAlloc (
- HLOCAL hMem,
- UINT uBytes,
- UINT uFlags
- )
-{
- SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
- return 0;
-}
-
-
-UINT
-STDCALL
-LocalShrink (
- HLOCAL hMem,
- UINT cbNewSize
- )
+//FIXME! move to correct file
+INT STDCALL MulDiv(
+ INT nMultiplicand,
+ INT nMultiplier,
+ INT nDivisor)
{
- SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
- return 0;
-}
+#if SIZEOF_LONG_LONG >= 8
+ long long ret;
+ if (!nDivisor) return -1;
-UINT
-STDCALL
-LocalSize (
- HLOCAL hMem
- )
-{
- SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
- return 0;
-}
+ /* We want to deal with a positive divisor to simplify the logic. */
+ if (nDivisor < 0)
+ {
+ nMultiplicand = - nMultiplicand;
+ nDivisor = -nDivisor;
+ }
+ /* If the result is positive, we "add" to round. else, we subtract to round. */
+ if ( ( (nMultiplicand < 0) && (nMultiplier < 0) ) ||
+ ( (nMultiplicand >= 0) && (nMultiplier >= 0) ) )
+ ret = (((long long)nMultiplicand * nMultiplier) + (nDivisor/2)) / nDivisor;
+ else
+ ret = (((long long)nMultiplicand * nMultiplier) - (nDivisor/2)) / nDivisor;
-WINBOOL
-STDCALL
-LocalUnlock (
- HLOCAL hMem
- )
-{
- SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
- return FALSE;
-}
+ if ((ret > 2147483647) || (ret < -2147483647)) return -1;
+ return ret;
+#else
+ if (!nDivisor) return -1;
+ /* We want to deal with a positive divisor to simplify the logic. */
+ if (nDivisor < 0)
+ {
+ nMultiplicand = - nMultiplicand;
+ nDivisor = -nDivisor;
+ }
-int
-STDCALL
-MulDiv (
- int nNumber,
- int nNumerator,
- int nDenominator
- )
-{
- SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
- return 0;
-}
+ /* If the result is positive, we "add" to round. else, we subtract to round. */
+ if ( ( (nMultiplicand < 0) && (nMultiplier < 0) ) ||
+ ( (nMultiplicand >= 0) && (nMultiplier >= 0) ) )
+ return ((nMultiplicand * nMultiplier) + (nDivisor/2)) / nDivisor;
+ return ((nMultiplicand * nMultiplier) - (nDivisor/2)) / nDivisor;
-/**********************************************************************
- * NAME PRIVATE
- * IsInstalledCP@4
- *
- * RETURN VALUE
- * TRUE if CodePage is installed in the system.
- */
-static
-BOOL
-STDCALL
-IsInstalledCP (
- UINT CodePage
- )
-{
- /* FIXME */
- return TRUE;
+#endif
}
* MB_COMPOSITE
* MB_ERR_INVALID_CHARS
* MB_USEGLYPHCHARS
- *
+ *
* lpMultiByteStr
* Input buffer;
- *
+ *
* cchMultiByte
* Size of MultiByteStr, or -1 if MultiByteStr is
* NULL terminated;
- *
+ *
* lpWideCharStr
* Output buffer;
- *
+ *
* cchWideChar
* Size (in WCHAR unit) of WideCharStr, or 0
* if the caller just wants to know how large
*
* NOTE
* A raw converter for now. It assumes lpMultiByteStr is
- * NEVER multi-byte (that is each input character is
+ * NEVER multi-byte (that is each input character is
* 8-bit ASCII) and is ALWAYS NULL terminated.
* FIXME-FIXME-FIXME-FIXME
*/
for ( cchConverted = 0,
r = (PCHAR) lpMultiByteStr,
w = (PWCHAR) lpWideCharStr;
-
+
((*r) && (cchConverted < cchWideChar));
r++,
}
-
-
-
-
-
-
-
WINBOOL
STDCALL
QueryPerformanceCounter (
}
-
-
-
-
-
WINBOOL
STDCALL
RegisterConsoleVDM (
}
-
-
WINBOOL
STDCALL
SetComputerNameA (
}
-
-
-
-
-
-
-
-
WINBOOL
STDCALL
SetLocaleInfoA (
}
-
-
-
-
-
WINBOOL
STDCALL
SetSystemPowerState (
return FALSE;
}
-
-
+WINBOOL
+STDCALL
+SetThreadIdealProcessor(VOID)
+{
+ SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+ return 0;
+}
WINBOOL
STDCALL
return FALSE;
}
+WINBOOL
+STDCALL
+SetThreadPriorityBoost(VOID)
+{
+ SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+ return 0;
+}
WINBOOL
STDCALL
}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
DWORD
STDCALL
TrimVirtualBuffer (
}
-
-
DWORD
STDCALL
VDMConsoleOperation (
}
-
-
-
DWORD
STDCALL
VirtualBufferExceptionHandler (
}
-
-
+/**********************************************************************
+ * NAME EXPORTED
+ * MultiByteToWideChar@32
+ *
+ * Not yet implemented complete (without NLS so far)
+ *
+ * ARGUMENTS
+ * CodePage
+ * CP_ACP ANSI code page
+ * CP_MACCP Macintosh code page
+ * CP_OEMCP OEM code page
+ * CP_SYMBOL Symbol code page (42)
+ * CP_THREAD_ACP Current thread's ANSI code page
+ * CP_UTF7 Translate using UTF-7
+ * CP_UTF8 Translate using UTF-8
+ * (UINT) Any installed code page
+ *
+ * dwFlags
+ * WC_NO_BEST_FIT_CHARS
+ * WC_COMPOSITECHECK Convert composite characters to precomposed characters.
+ * WC_DISCARDNS Discard nonspacing characters during conversion.
+ * WC_SEPCHARS Generate separate characters during conversion. This is the default conversion behavior.
+ * WC_DEFAULTCHAR Replace exceptions with the default character during conversion.
+ *
+ * lpWideCharStr
+ * Points to the wide-character string to be converted.
+ *
+ * cchWideChar
+ * Size (in WCHAR unit) of WideCharStr, or 0
+ * if the caller just wants to know how large
+ * WideCharStr should be for a successful
+ * conversion.
+ * lpMultiByteStr
+ * Points to the buffer to receive the translated string.
+ * cchMultiByte
+ * Specifies the size in bytes of the buffer pointed to by the
+ * lpMultiByteStr parameter. If this value is zero, the function
+ * returns the number of bytes required for the buffer.
+ * lpDefaultChar
+ * Points to the character used if a wide character cannot be
+ * represented in the specified code page. If this parameter is
+ * NULL, a system default value is used.
+ FIXME: ignored
+ * lpUsedDefaultChar
+ * Points to a flag that indicates whether a default character was used.
+ * This parameter may be NULL.
+ FIXME: allways set to FALSE.
+ *
+ *
+ *
+ * RETURN VALUE
+ * 0 on error; otherwise the number of bytes written
+ * in the lpMultiByteStr buffer. Or the number of
+ * bytes needed for the lpMultiByteStr buffer if cchMultiByte is zero.
+ *
+ * NOTE
+ * A raw converter for now. It just cuts off the upper 9 Bit.
+ * So the MBCS-string does not contain any LeadCharacters
+ * FIXME - FIXME - FIXME - FIXME
+ */
int
STDCALL
LPBOOL lpUsedDefaultChar
)
{
- SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+ int wi, di; // wide counter, dbcs byte count
+
+ // for now, make no difference but only convert cut the characters to 7Bit
+ switch( CodePage )
+ {
+ case CP_ACP: //ANSI code page
+ case CP_MACCP: //Macintosh code page
+ case CP_OEMCP: //OEM code page
+ case CP_SYMBOL: //Symbol code page (42)
+ case CP_THREAD_ACP: //ACP Current thread's ANSI code page
+ case CP_UTF7: //Translate using UTF-7
+ case CP_UTF8: //Translate using UTF-8
+ if( cchWideChar == -1 ) // assume its a 0-terminated str
+ { // and determine its length
+ for( cchWideChar=0; lpWideCharStr[cchWideChar]!=0; )
+ cchWideChar++;
+ }
+
+ // user wants to determine needed space
+ if( cchMultiByte == 0 )
+ {
+ SetLastError(ERROR_SUCCESS);
+ return cchWideChar; // FIXME: determine correct.
+ }
+ // the lpWideCharStr is cchWideChar characters long.
+ for( wi=0, di=0; wi<cchWideChar && di<cchMultiByte; ++wi)
+ {
+ // Flag and a not displayable char FIXME
+ /*if( (dwFlags&WC_NO_BEST_FIT_CHARS) && (lpWideCharStr[wi] >127) )
+ {
+ lpMultiByteStr[di]=
+ *lpUsedDefaultChar = TRUE;
+
+ }*/
+ // FIXME
+ // just cut off the upper 9 Bit, since vals>=128 mean LeadByte.
+ lpMultiByteStr[di] = lpWideCharStr[wi] & 0x007F;
+ ++di;
+ }
+ // has MultiByte exceeded but Wide is still in the string?
+ if( wi < cchWideChar && di >= cchMultiByte)
+ {
+ SetLastError(ERROR_INSUFFICIENT_BUFFER);
+ return di;
+ }
+ // else return # of bytes wirtten to MBCSbuffer (di)
+ SetLastError(ERROR_SUCCESS);
+ // FIXME: move that elsewhere
+ if( lpUsedDefaultChar!=NULL ) *lpUsedDefaultChar=FALSE;
+ return di;
+ break;
+ default:
+ SetLastError(ERROR_INVALID_PARAMETER);
+ return FALSE;
+ break;
+ }
+ SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
+
+
/* EOF */