Hello,

since almost a half week now i get stuck on using PlaySound in my private hack dll for A.V.A.
For some reason it only works ONCE when i play a "Hack successfully loaded" sound after the hack got injected and is loaded. Since it's only a hotkey hack with debug console atm i also wanted to add "Enabled" and "Disabled" sounds getting played after enabling/disabling a function but somehow the sounds are just not getting played. I already used GetLastError and got the error code 1812 = ERROR_RESOURCE_DATA_NOT_FOUND.
The code for this is (removed unimportant stuff):
Code:
#pragma comment(lib, "winmm.lib")
HINSTANCE hDLLInst; 

void InitializeDLL()
{
	AllocConsole();
	system("Color 0A");
	AttachConsole(GetCurrentProcessId());
	freopen("CONOUT$", "w", stdout);
	SetConsoleTitle("AVA private dll hotkey hack by ccman32");
	printf("Loading hack...\n");
	printf("Creating threads...\n");
	CreateThread(0, 0, HotkeyThread, 0, 0, 0); 
	printf("Threads created!\n");
	printf("Hack successfully loaded!\n");
	printf("hDLLInst before first PlaySound: %x\n", hDLLInst);
	PlaySound(MAKEINTRESOURCE(IDR_WAVE1), hDLLInst, SND_RESOURCE);
}

BOOL WINAPI DllMain(HINSTANCE hinstModule, DWORD dwReason, LPVOID lpvReserved)
{
	if(dwReason == DLL_PROCESS_ATTACH)
	{
		hDLLInst = hinstModule; 
		InitializeDLL();
		return TRUE;
	}

	return FALSE;
}

DWORD WINAPI HotkeyThread(void* pParams)
{
	while (1)
	{
                if (GetAsyncKeyState (VK_UP) &1) 
		{
			bExampleFunction = !bExampleFunction;
			if (bExampleFunction == 1)
			{
				PlayEnabled();
				printf("Example function enabled\n");
			}
			else if (bExampleFunction == 0)
			{
				PlayDisabled();
				printf("Example function disabled\n");
			}
		}
                Sleep(25);
	}
	Sleep(2000);
}

inline void PlayEnabled()
{
	PlaySound(MAKEINTRESOURCE(IDR_WAVE2), hDLLInst, SND_RESOURCE);
	printf("Error Code: %d\n", GetLastError());
	printf("hDLLInst: %x\n", hDLLInst);
}

inline void PlayDisabled()
{
	PlaySound(MAKEINTRESOURCE(IDR_WAVE3), hDLLInst, SND_RESOURCE);
	printf("Error Code: %d\n", GetLastError());
	printf("hDLLInst: %x\n", hDLLInst);
}
and the result i get is:



Any ideas?