Bug 1123966 - Use FILE_FLAG_DELETE_ON_CLOSE instead of RemoveFile. r=akloyz

This commit is contained in:
Makoto Kato 2015-01-25 15:37:39 +09:00
parent 1e05700331
commit a15474f0cb
2 changed files with 2 additions and 18 deletions

View File

@ -85,7 +85,6 @@ typedef HANDLE (WINAPI *CreateFileWPtr)(LPCWSTR fname, DWORD access,
DWORD creation, DWORD flags, DWORD creation, DWORD flags,
HANDLE ftemplate); HANDLE ftemplate);
static CreateFileWPtr sCreateFileWStub = nullptr; static CreateFileWPtr sCreateFileWStub = nullptr;
static WCHAR* sReplacementConfigFile;
// Used with fix for flash fullscreen window loosing focus. // Used with fix for flash fullscreen window loosing focus.
static bool gDelayFlashFocusReplyUntilEval = false; static bool gDelayFlashFocusReplyUntilEval = false;
@ -1933,10 +1932,6 @@ PluginModuleChild::DoNP_Initialize(const PluginSettings& aSettings)
# error Please implement me for your platform # error Please implement me for your platform
#endif #endif
#ifdef XP_WIN
CleanupProtectedModeHook();
#endif
return result; return result;
} }
@ -1971,7 +1966,8 @@ CreateFileHookFn(LPCWSTR fname, DWORD access, DWORD share,
HANDLE replacement = HANDLE replacement =
sCreateFileWStub(tempFile, GENERIC_READ | GENERIC_WRITE, share, sCreateFileWStub(tempFile, GENERIC_READ | GENERIC_WRITE, share,
security, TRUNCATE_EXISTING, security, TRUNCATE_EXISTING,
FILE_ATTRIBUTE_TEMPORARY, FILE_ATTRIBUTE_TEMPORARY |
FILE_FLAG_DELETE_ON_CLOSE,
NULL); NULL);
if (replacement == INVALID_HANDLE_VALUE) { if (replacement == INVALID_HANDLE_VALUE) {
break; break;
@ -2001,7 +1997,6 @@ CreateFileHookFn(LPCWSTR fname, DWORD access, DWORD share,
WriteFile(replacement, static_cast<const void*>(kSettingString), WriteFile(replacement, static_cast<const void*>(kSettingString),
sizeof(kSettingString) - 1, &wbytes, NULL); sizeof(kSettingString) - 1, &wbytes, NULL);
SetFilePointer(replacement, 0, NULL, FILE_BEGIN); SetFilePointer(replacement, 0, NULL, FILE_BEGIN);
sReplacementConfigFile = _wcsdup(tempFile);
return replacement; return replacement;
} }
return sCreateFileWStub(fname, access, share, security, creation, flags, return sCreateFileWStub(fname, access, share, security, creation, flags,
@ -2017,16 +2012,6 @@ PluginModuleChild::HookProtectedMode()
(void**) &sCreateFileWStub); (void**) &sCreateFileWStub);
} }
void
PluginModuleChild::CleanupProtectedModeHook()
{
if (sReplacementConfigFile) {
DeleteFile(sReplacementConfigFile);
free(sReplacementConfigFile);
sReplacementConfigFile = nullptr;
}
}
BOOL WINAPI BOOL WINAPI
PMCGetWindowInfoHook(HWND hWnd, PWINDOWINFO pwi) PMCGetWindowInfoHook(HWND hWnd, PWINDOWINFO pwi)
{ {

View File

@ -307,7 +307,6 @@ private:
#if defined(OS_WIN) #if defined(OS_WIN)
void HookProtectedMode(); void HookProtectedMode();
void CleanupProtectedModeHook();
#endif #endif
#if defined(MOZ_WIDGET_GTK) #if defined(MOZ_WIDGET_GTK)