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

View File

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