2424#include " gitinfo.h"
2525
2626// Globals for storing the pointer to the exception
27- _EXCEPTION_POINTERS* g_dumpException = NULL ;
27+ _EXCEPTION_POINTERS* g_dumpException = nullptr ;
2828DWORD g_dumpExceptionThreadId = 0 ;
2929
30- MiniDumper* TheMiniDumper = NULL ;
30+ MiniDumper* TheMiniDumper = nullptr ;
3131
3232// Globals containing state about the current exception that's used for context in the mini dump.
3333// These are populated by MiniDumper::DumpingExceptionFilter to store a copy of the exception in case it goes out of scope
@@ -39,7 +39,7 @@ constexpr const char* DumpFileNamePrefix = "Crash";
3939
4040void MiniDumper::initMiniDumper (const AsciiString& userDirPath)
4141{
42- DEBUG_ASSERTCRASH (TheMiniDumper == NULL , (" MiniDumper::initMiniDumper called on already created instance" ));
42+ DEBUG_ASSERTCRASH (TheMiniDumper == nullptr , (" MiniDumper::initMiniDumper called on already created instance" ));
4343
4444 // Use placement new on the process heap so TheMiniDumper is placed outside the MemoryPoolFactory managed area.
4545 // If the crash is due to corrupted MemoryPoolFactory structures, try to mitigate the chances of MiniDumper memory also being corrupted
@@ -54,7 +54,7 @@ void MiniDumper::shutdownMiniDumper()
5454 TheMiniDumper->ShutDown ();
5555 TheMiniDumper->~MiniDumper ();
5656 ::HeapFree (::GetProcessHeap(), NULL, TheMiniDumper);
57- TheMiniDumper = NULL ;
57+ TheMiniDumper = nullptr ;
5858 }
5959}
6060
@@ -63,10 +63,10 @@ MiniDumper::MiniDumper()
6363 m_miniDumpInitialized = false ;
6464 m_loadedDbgHelp = false ;
6565 m_requestedDumpType = DumpType_Minimal;
66- m_dumpRequested = NULL ;
67- m_dumpComplete = NULL ;
68- m_quitting = NULL ;
69- m_dumpThread = NULL ;
66+ m_dumpRequested = nullptr ;
67+ m_dumpComplete = nullptr ;
68+ m_quitting = nullptr ;
69+ m_dumpThread = nullptr ;
7070 m_dumpThreadId = 0 ;
7171 m_dumpDir[0 ] = 0 ;
7272 m_dumpFile[0 ] = 0 ;
@@ -145,7 +145,7 @@ void MiniDumper::Initialize(const AsciiString& userDirPath)
145145 return ;
146146 }
147147
148- DWORD executableSize = ::GetModuleFileNameW (NULL , m_executablePath, ARRAY_SIZE (m_executablePath));
148+ DWORD executableSize = ::GetModuleFileNameW (nullptr , m_executablePath, ARRAY_SIZE (m_executablePath));
149149 if (executableSize == 0 || executableSize == ARRAY_SIZE (m_executablePath))
150150 {
151151 DEBUG_LOG ((" MiniDumper::Initialize: Could not get executable file name. Returned value=%u" , executableSize));
@@ -158,18 +158,18 @@ void MiniDumper::Initialize(const AsciiString& userDirPath)
158158 return ;
159159 }
160160
161- m_dumpRequested = CreateEvent (NULL , TRUE , FALSE , NULL );
162- m_dumpComplete = CreateEvent (NULL , TRUE , FALSE , NULL );
163- m_quitting = CreateEvent (NULL , TRUE , FALSE , NULL );
161+ m_dumpRequested = CreateEvent (nullptr , TRUE , FALSE , nullptr );
162+ m_dumpComplete = CreateEvent (nullptr , TRUE , FALSE , nullptr );
163+ m_quitting = CreateEvent (nullptr , TRUE , FALSE , nullptr );
164164
165- if (m_dumpRequested == NULL || m_dumpComplete == NULL || m_quitting == NULL )
165+ if (m_dumpRequested == nullptr || m_dumpComplete == nullptr || m_quitting == nullptr )
166166 {
167167 // Something went wrong with the creation of the events..
168168 DEBUG_LOG ((" MiniDumper::Initialize: Unable to create events: error=%u" , ::GetLastError ()));
169169 return ;
170170 }
171171
172- m_dumpThread = ::CreateThread (NULL , 0 , MiniDumpThreadProc, this , CREATE_SUSPENDED, &m_dumpThreadId);
172+ m_dumpThread = ::CreateThread (nullptr , 0 , MiniDumpThreadProc, this , CREATE_SUSPENDED, &m_dumpThreadId);
173173 if (!m_dumpThread)
174174 {
175175 DEBUG_LOG ((" MiniDumper::Initialize: Unable to create thread: error=%u" , ::GetLastError ()));
@@ -194,7 +194,7 @@ Bool MiniDumper::IsInitialized() const
194194Bool MiniDumper::IsDumpThreadStillRunning () const
195195{
196196 DWORD exitCode;
197- if (m_dumpThread != NULL && ::GetExitCodeThread (m_dumpThread, &exitCode) && exitCode == STILL_ACTIVE)
197+ if (m_dumpThread != nullptr && ::GetExitCodeThread (m_dumpThread, &exitCode) && exitCode == STILL_ACTIVE)
198198 {
199199 return true ;
200200 }
@@ -211,7 +211,7 @@ Bool MiniDumper::InitializeDumpDirectory(const AsciiString& userDirPath)
211211 strlcat (m_dumpDir, " CrashDumps\\ " , ARRAY_SIZE (m_dumpDir));
212212 if (::_access (m_dumpDir, 0 ) != 0 )
213213 {
214- if (!::CreateDirectory (m_dumpDir, NULL ))
214+ if (!::CreateDirectory (m_dumpDir, nullptr ))
215215 {
216216 DEBUG_LOG ((" MiniDumper::Initialize: Unable to create path for crash dumps at '%s': error=%u" , m_dumpDir, ::GetLastError ()));
217217 return false ;
@@ -229,7 +229,7 @@ void MiniDumper::ShutdownDumpThread()
229229{
230230 if (IsDumpThreadStillRunning ())
231231 {
232- DEBUG_ASSERTCRASH (m_quitting != NULL , (" MiniDumper::ShutdownDumpThread: Dump thread still running despite m_quitting being NULL " ));
232+ DEBUG_ASSERTCRASH (m_quitting != nullptr , (" MiniDumper::ShutdownDumpThread: Dump thread still running despite m_quitting being nullptr " ));
233233 ::SetEvent (m_quitting);
234234
235235 DWORD waitRet = ::WaitForSingleObject (m_dumpThread, 3000 );
@@ -256,29 +256,29 @@ void MiniDumper::ShutDown()
256256{
257257 ShutdownDumpThread ();
258258
259- if (m_dumpThread != NULL )
259+ if (m_dumpThread != nullptr )
260260 {
261261 DEBUG_ASSERTCRASH (!IsDumpThreadStillRunning (), (" MiniDumper::ShutDown: ShutdownDumpThread() was unable to stop Dump thread" ));
262262 ::CloseHandle (m_dumpThread);
263- m_dumpThread = NULL ;
263+ m_dumpThread = nullptr ;
264264 }
265265
266- if (m_quitting != NULL )
266+ if (m_quitting != nullptr )
267267 {
268268 ::CloseHandle (m_quitting);
269- m_quitting = NULL ;
269+ m_quitting = nullptr ;
270270 }
271271
272- if (m_dumpComplete != NULL )
272+ if (m_dumpComplete != nullptr )
273273 {
274274 ::CloseHandle (m_dumpComplete);
275- m_dumpComplete = NULL ;
275+ m_dumpComplete = nullptr ;
276276 }
277277
278- if (m_dumpRequested != NULL )
278+ if (m_dumpRequested != nullptr )
279279 {
280280 ::CloseHandle (m_dumpRequested);
281- m_dumpRequested = NULL ;
281+ m_dumpRequested = nullptr ;
282282 }
283283
284284 if (m_loadedDbgHelp)
@@ -320,9 +320,9 @@ DWORD MiniDumper::ThreadProcInternal()
320320
321321DWORD WINAPI MiniDumper::MiniDumpThreadProc (LPVOID lpParam)
322322{
323- if (lpParam == NULL )
323+ if (lpParam == nullptr )
324324 {
325- DEBUG_LOG ((" MiniDumper::MiniDumpThreadProc: The provided parameter was NULL , exiting thread." ));
325+ DEBUG_LOG ((" MiniDumper::MiniDumpThreadProc: The provided parameter was nullptr , exiting thread." ));
326326 return MiniDumperExitCode_FailureParam;
327327 }
328328
@@ -350,16 +350,16 @@ void MiniDumper::CreateMiniDump(DumpType dumpType)
350350 sysTime.wDay , sysTime.wHour , sysTime.wMinute , sysTime.wSecond ,
351351 GitShortSHA1, currentProcessId);
352352
353- HANDLE dumpFile = ::CreateFile (m_dumpFile, GENERIC_READ | GENERIC_WRITE, 0 , NULL , CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL );
354- if (dumpFile == NULL || dumpFile == INVALID_HANDLE_VALUE)
353+ HANDLE dumpFile = ::CreateFile (m_dumpFile, GENERIC_READ | GENERIC_WRITE, 0 , nullptr , CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr );
354+ if (dumpFile == nullptr || dumpFile == INVALID_HANDLE_VALUE)
355355 {
356356 DEBUG_LOG ((" MiniDumper::CreateMiniDump: Unable to create dump file '%s': error=%u" , m_dumpFile, ::GetLastError ()));
357357 return ;
358358 }
359359
360- PMINIDUMP_EXCEPTION_INFORMATION exceptionInfoPtr = NULL ;
360+ PMINIDUMP_EXCEPTION_INFORMATION exceptionInfoPtr = nullptr ;
361361 MINIDUMP_EXCEPTION_INFORMATION exceptionInfo = { 0 };
362- if (g_dumpException != NULL )
362+ if (g_dumpException != nullptr )
363363 {
364364 exceptionInfo.ExceptionPointers = g_dumpException;
365365 exceptionInfo.ThreadId = g_dumpExceptionThreadId;
@@ -386,8 +386,8 @@ void MiniDumper::CreateMiniDump(DumpType dumpType)
386386 dumpFile,
387387 miniDumpType,
388388 exceptionInfoPtr,
389- NULL ,
390- NULL );
389+ nullptr ,
390+ nullptr );
391391
392392 if (!success)
393393 {
0 commit comments