fix some of the mess Lentin created here

-don't use TCHAR in ANSI functions
-add a DllMain otherwise a random memory address is called when loading the dll
-add DPRINT1 to all stubs

svn path=/trunk/; revision=36305
This commit is contained in:
Christoph von Wittich 2008-09-18 16:48:38 +00:00
parent d65eb0ae05
commit e5131cbe38

View file

@ -21,21 +21,37 @@
#include <windows.h>
#include <stdio.h>
#include <wchar.h>
#include <tchar.h>
#include <debug.h>
#define NDEBUG
#define MAX_ERROR_TEXT_LEN 160
BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv)
{
switch(fdwReason) {
case DLL_PROCESS_ATTACH:
DisableThreadLibraryCalls(hInstDLL);
break;
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
DWORD WINAPI
AMGetErrorTextA(HRESULT hr, LPTSTR buffer, DWORD maxlen)
{
int len;
static const TCHAR format[] = {'E','r','r','o','r',':',' ','0','x','%','l','x',0};
TCHAR error[MAX_ERROR_TEXT_LEN];
static const char format[] = "Error: 0x%lx";
char error[MAX_ERROR_TEXT_LEN];
DPRINT1("FIXME (%x,%p,%d) stub\n", hr, buffer, maxlen);
if (!buffer) return 0;
_stprintf(error, format, hr);
if ((len = _tcslen(error)) >= maxlen) return 0;
_tcscpy(buffer, error);
sprintf(error, format, hr);
if ((len = strlen(error)) >= maxlen) return 0;
strcpy(buffer, error);
return len;
}
@ -46,6 +62,8 @@ AMGetErrorTextW(HRESULT hr, LPWSTR buffer, DWORD maxlen)
static const WCHAR format[] = {'E','r','r','o','r',':',' ','0','x','%','l','x',0};
WCHAR error[MAX_ERROR_TEXT_LEN];
DPRINT1("FIXME (%x,%p,%d) stub\n", hr, buffer, maxlen);
if (!buffer) return 0;
swprintf(error, format, hr);
if ((len = wcslen(error)) >= maxlen) return 0;
@ -56,12 +74,14 @@ AMGetErrorTextW(HRESULT hr, LPWSTR buffer, DWORD maxlen)
LONG WINAPI
AmpFactorToDB(LONG ampfactor)
{
DPRINT1("FIXME (%d) Stub!\n", ampfactor);
return 0;
}
LONG WINAPI
DBToAmpFactor(LONG db)
{
DPRINT1("FIXME (%d) Stub!\n", db);
/* Avoid divide by zero (probably during range computation) in Windows Media Player 6.4 */
if (db < -1000)
return 0;