Цитата(CynicRus @ 14.8.2012, 11:27 ) | | я получаю ошибку: error: too many initializers for 'SFunctionHook* [0]'. Собственно - каким образом разрешить данную проблему? |
То что я нашел, выглядет вот так
| Код | struct SDLLHook { // Name of the DLL, e.g. "DDRAW.DLL" char* Name; // Set true to call the default for all non-hooked functions before they are executed. bool UseDefault; void* DefaultFn; // Function hook array. Terminated with a NULL Name field. SFunctionHook Functions[]; };
|
Что соответствует вот этому:
| Код | struct SDLLHook { // Name of the DLL, e.g. "DDRAW.DLL" char* Name; // Set true to call the default for all non-hooked functions before they are executed. bool UseDefault; void* DefaultFn; // Function hook array. Terminated with a NULL Name field. SFunctionHook Functions[0]; };
|
Соответственно вы не можете запихать в Functions больше элементов, чем 0. А использоваться это, по идее, должно вот так:
| Код | int function_count = 2; void* mem_ptr = malloc(sizeof(SDLLHook) + sizeof(SFunctionHook) * function_count); SDLLHook *D3DHookPtr = (SDLLHook *)mem_ptr; D3DHookPtr->Name = "DDRAW.DLL"; D3DHookPtr->UseDefault = false; D3DHookPtr->DefaultFn = NULL; D3DHookPtr->Functions[0] = { "DirectDrawCreateEx", MyDirectDrawCreateEx, NULL }; D3DHookPtr->Functions[1] = { NULL, NULL, NULL };
|
|