All pastes #138155 Raw Edit

Mine

public text v1 · immutable
#138155 ·published 2006-08-19 00:32 UTC
rendered paste body
DLLAPI BOOL DllInjectEx(HANDLE hProcess, LPSTR lpszDLL, DWORD dFlags)
{
    char buffer[MAX_PATH];
    memset(buffer, 0, MAX_PATH);
    if (dFlags & DLL_INJECT_RELATIVE) {
               GetCurrentDirectory(MAX_PATH - 1 - strlen(lpszDLL), &buffer);
               strcat(buffer, lpszDLL);
    } else
               strcpy(buffer, lpszDLL);
    
    if (dFlags & DLL_INJECT_GETDBGPRIVS) 
               if (!EnableDebugPrivileges(GetCurrentProcess()))
                  return FALSE;
    
    return DllInject(hProcess, buffer);
}