Results 1 to 3 of 3
  1. #1
    We are the CONTRIBUFORCE
    Contributor
    ccman32's Avatar
    Join Date
    Oct 2010
    Gender
    male
    Location
    Germany
    Posts
    1,150
    Reputation
    236
    Thanks
    19,425
    My Mood
    Devilish

    Question PlaySound not finding the sound resource

    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?

  2. #2
    Banned
    BANNED!
    AVA_Hack's Avatar
    Join Date
    Apr 2013
    Gender
    male
    Posts
    15
    Reputation
    10
    Thanks
    6
    My Mood
    Amazed
    Hey @ccman32 i am a professional programmer and coder
    Code
    PlayEnabled();
    printf("Example function enabled\n");

    something is wrong with this.

  3. #3
    We Like Beaches
    MPGH Member
    WhiteHat PH's Avatar
    Join Date
    Aug 2012
    Gender
    male
    Location
    Some Where I Belong
    Posts
    1,294
    Reputation
    25
    Thanks
    2,696
    My Mood
    Drunk
    nopes what wrong with that???

Similar Threads

  1. * I can not find a procusse the ava
    By mahnes in forum Alliance of Valiant Arms (AVA) Help
    Replies: 4
    Last Post: 10-15-2012, 09:36 AM
  2. Replies: 2
    Last Post: 04-09-2012, 11:32 AM
  3. [Solved] Could Not Find Suitable .SND Sound Driver?
    By IrAustinPSN in forum CrossFire Help
    Replies: 2
    Last Post: 02-20-2012, 10:40 PM
  4. [Solved] HELP! I can not find the latest console !
    By a4919935 in forum Vindictus Help
    Replies: 6
    Last Post: 01-10-2012, 11:00 AM
  5. Replies: 4
    Last Post: 05-28-2010, 10:12 PM