I don't get it. My whole program compiles fine, but it throws an Access Violation segmentation fault when it tries to access this function. The function is declared properly and so are the arguments, but it it can't even be stepped into with Dev-C++ debugger before throwing that error. I try to look at "Next Step" in the debugger and I get that error. It's not making any sense.

(u32 is just my designation for Unsigned Int)

Code:
DumpRAM(sdFileName, &NewRAM);

u32 DumpRAM(char* DumpName, u8 **ramdata)
{
    u32 filesize = 0;
    u32 chunksize = 0x1000000;
    DWORD bytesread;
    u8 buffer[0x1000000];
    u32 RamStart = Settings.Hook.rOffset;
    if (!VerifyHook()) {
        MessageBox(NULL,"ProcessID no longer valid. Unable to read memory (DumpRAM, 1)", "Error", MB_OK);
        return 0;
    }
    if (Settings.Hook.sType == RAM_POINTER) {
        if (!ReadProcessMemory(HookedProcess.hProcess, (void*)Settings.Hook.rOffset, (void*)RamStart, chunksize, &bytesread)) {
            return 0;
        }

    }
    //testing
    sprintf(ErrTxt, "%u", RamStart);
    MessageBox(NULL,ErrTxt,"Error",0);
    return 0;
    //testing
    if (*ramdata) { free(*ramdata); *ramdata = 0; }
    do {
        if ((Settings.Hook.AutoRam == BST_UNCHECKED) && (Settings.Hook.MaxRamSize)) {
            filesize = Settings.Hook.MaxRamSize;
        } else { filesize += chunksize; }
        if (ReadProcessMemory(HookedProcess.hProcess, (void*)RamStart, (void *)buffer, chunksize, &bytesread)) {
        }
        if (!(*ramdata = (unsigned char*)realloc(*ramdata, filesize))) {
            MessageBox(NULL, "Unable to allocate buffer memory (DumpRAM,1).", "Error", MB_OK);
            return 0;
        }
    } while((Settings.Hook.AutoRam == BST_CHECKED) && (chunksize > 0));
    return 0;
}

int VerifyHook()
{
    char szProcessName[MAX_PATH];
    GetModuleBaseName( HookedProcess.hProcess, NULL, szProcessName, MAX_PATH );
    if (StringCompareCI(szProcessName, Settings.Hook.FileName)) { return 0; }
    return 1; //returns 1 if hook is still good
}