Bug 1867925 - Mark some storage-access-api tests as intermittent after wpt-sync....
[gecko.git] / build / win32 / crashinjectdll / crashinjectdll.cpp
blob7ee7e6812d1a33ed2a7650e78aeca336c5864add
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #include <stdio.h>
6 #include <windows.h>
8 // make sure we only ever spawn one thread
9 DWORD tid = -1;
11 DWORD WINAPI CrashingThread(LPVOID lpParameter) {
12 // not a very friendly DLL
13 volatile int* x = (int*)0x0;
14 *x = 1;
15 return 0;
18 BOOL WINAPI DllMain(HANDLE hinstDLL, DWORD dwReason, LPVOID lpvReserved) {
19 if (tid == (DWORD)-1)
20 // we have to crash on another thread because LoadLibrary() will
21 // catch memory access errors and return failure to the calling process
22 CreateThread(nullptr, // default security attributes
23 0, // use default stack size
24 CrashingThread, // thread function name
25 nullptr, // argument to thread function
26 0, // use default creation flags
27 &tid); // returns the thread identifier
28 return TRUE;