UsbDk: Trivial: Replace NULL with nullptr

Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
This commit is contained in:
Dmitry Fleytman 2014-04-28 10:42:38 +03:00
parent d680b5b139
commit 6d5b7151ee
12 changed files with 83 additions and 83 deletions

View file

@ -22,7 +22,7 @@ PWCHAR CWdfDeviceAccess::QueryBusID(BUS_QUERY_ID_TYPE idType)
{
UNREFERENCED_PARAMETER(idType);
ASSERT(!"NOT IMPLEMENTED");
return NULL;
return nullptr;
}
NTSTATUS CWdfDeviceAccess::QueryCapabilities(DEVICE_CAPABILITIES &Capabilities)
@ -48,7 +48,7 @@ CMemoryBuffer *CWdfDeviceAccess::GetDeviceProperty(DEVICE_REGISTRY_PROPERTY prop
return CMemoryBuffer::GetMemoryBuffer(devProperty);
}
return NULL;
return nullptr;
}
PWCHAR CWdmDeviceAccess::QueryBusID(BUS_QUERY_ID_TYPE idType)
@ -60,7 +60,7 @@ PWCHAR CWdmDeviceAccess::QueryBusID(BUS_QUERY_ID_TYPE idType)
if (!NT_SUCCESS(status))
{
TraceEvents(TRACE_LEVEL_ERROR, TRACE_DEVACCESS, "%!FUNC! Error %!STATUS! during IRP creation", status);
return NULL;
return nullptr;
}
irp.Configure([idType] (PIO_STACK_LOCATION s)
@ -75,7 +75,7 @@ PWCHAR CWdmDeviceAccess::QueryBusID(BUS_QUERY_ID_TYPE idType)
if (!NT_SUCCESS(status))
{
TraceEvents(TRACE_LEVEL_ERROR, TRACE_DEVACCESS, "%!FUNC! Error %!STATUS! during %!devid! query", status, idType);
return NULL;
return nullptr;
}
PWCHAR idData;
@ -151,8 +151,8 @@ CMemoryBuffer *CWdmDeviceAccess::GetDeviceProperty(DEVICE_REGISTRY_PROPERTY prop
PAGED_CODE();
ULONG bytesNeeded = NULL;
auto status = IoGetDeviceProperty(m_DevObj, propertyId, 0, NULL, &bytesNeeded);
ULONG bytesNeeded = 0;
auto status = IoGetDeviceProperty(m_DevObj, propertyId, 0, nullptr, &bytesNeeded);
if (!NT_SUCCESS(status))
{
@ -191,10 +191,10 @@ CMemoryBuffer *CWdmDeviceAccess::GetDeviceProperty(DEVICE_REGISTRY_PROPERTY prop
{
TraceEvents(TRACE_LEVEL_INFORMATION, TRACE_DEVACCESS,
"%!FUNC! Empty property read for device 0x%p, %!devprop!", m_DevObj, propertyId);
return CMemoryBuffer::GetMemoryBuffer(NULL, 0);
return CMemoryBuffer::GetMemoryBuffer(nullptr, 0);
}
return NULL;
return nullptr;
}
NTSTATUS CWdmUsbDeviceAccess::Reset()

View file

@ -49,7 +49,7 @@ public:
NTSTATUS SetPreprocessCallback(PFN_WDFDEVICE_WDM_IRP_PREPROCESS Callback, UCHAR MajorFunction)
{
return SetPreprocessCallback(Callback, MajorFunction, NULL, 0);
return SetPreprocessCallback(Callback, MajorFunction, nullptr, 0);
}
void SetIoInCallerContextCallback(PFN_WDF_IO_IN_CALLER_CONTEXT Callback)

View file

@ -5,7 +5,7 @@
InstallResult DeviceMgr::ResetDeviceByClass(const GUID &ClassGuid)
{
auto hDevInfo = SetupDiGetClassDevsEx(&ClassGuid, NULL, NULL, DIGCF_DEVICEINTERFACE | DIGCF_PRESENT, NULL, NULL, NULL);
auto hDevInfo = SetupDiGetClassDevsEx(&ClassGuid, nullptr, nullptr, DIGCF_DEVICEINTERFACE | DIGCF_PRESENT, nullptr, nullptr, nullptr);
if (hDevInfo == INVALID_HANDLE_VALUE)
{
throw UsbDkDeviceMgrException(TEXT("SetupDiGetClassDevsEx() failed!!"));

View file

@ -8,10 +8,10 @@ UsbDkDriverFile::UsbDkDriverFile(LPCTSTR lpFileName)
m_hDriver = CreateFile(lpFileName,
GENERIC_READ | GENERIC_WRITE,
0,
NULL,
nullptr,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,
NULL);
nullptr);
if (m_hDriver == INVALID_HANDLE_VALUE)
{

View file

@ -131,12 +131,12 @@ tstring UsbDkW32ErrorException::GetErrorString(DWORD dwErrorCode)
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS|
FORMAT_MESSAGE_MAX_WIDTH_MASK,
NULL,
nullptr,
dwErrorCode,
MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US),
(LPTSTR) &lpMsgBuf,
0,
NULL);
nullptr);
if(msgLen == 0)
{
tstringstream strm;

View file

@ -123,7 +123,7 @@ void UsbDkInstaller::addUsbDkToRegistry()
// check for value size
DWORD valLen = 0;
auto errCode = m_regAccess.ReadMultiString(upperFilterString, NULL, 0, valLen, upperFiltersKeyStr);
auto errCode = m_regAccess.ReadMultiString(upperFilterString, nullptr, 0, valLen, upperFiltersKeyStr);
if (errCode != ERROR_FILE_NOT_FOUND && errCode != ERROR_SUCCESS)
{
@ -170,7 +170,7 @@ void UsbDkInstaller::removeUsbDkFromRegistry()
// check for value size
DWORD valLen = 0;
auto errCode = m_regAccess.ReadMultiString(upperFilterString, NULL, 0, valLen, upperFiltersKeyStr);
auto errCode = m_regAccess.ReadMultiString(upperFilterString, nullptr, 0, valLen, upperFiltersKeyStr);
if (errCode != ERROR_FILE_NOT_FOUND && errCode != ERROR_SUCCESS)
{

View file

@ -10,12 +10,12 @@
//////////////////////////////////////////////////////////////////////
UsbDkRegAccess::UsbDkRegAccess()
: m_lpsRegPath(NULL), m_hkPrimaryHKey(0)
: m_lpsRegPath(nullptr), m_hkPrimaryHKey(0)
{
}
UsbDkRegAccess::UsbDkRegAccess(HKEY hNewPrKey, LPCTSTR lpzNewRegPath)
: m_lpsRegPath(NULL), m_hkPrimaryHKey(0)
: m_lpsRegPath(nullptr), m_hkPrimaryHKey(0)
{
SetPrimaryKey(hNewPrKey);
if (SetRegPath(lpzNewRegPath) == FALSE)
@ -40,12 +40,12 @@ BOOL UsbDkRegAccess::SetRegPath(LPCTSTR lpzNewRegPath)
if (!lpzNewRegPath)
{
m_lpsRegPath = NULL;
m_lpsRegPath = nullptr;
return TRUE;
}
m_lpsRegPath = _tcsdup(lpzNewRegPath);
return (m_lpsRegPath != NULL)?TRUE:FALSE;
return (m_lpsRegPath != nullptr)?TRUE:FALSE;
}
HKEY UsbDkRegAccess::GetPrimaryKey(VOID)
@ -86,7 +86,7 @@ BOOL UsbDkRegAccess::ReadDWord(LPCTSTR lpzValueName,
DWORD dwValue = 0,
dwSize = sizeof(dwValue),
dwType = REG_DWORD;
HKEY hkReadKeyHandle = NULL;
HKEY hkReadKeyHandle = nullptr;
TCHAR tcaFullRegPath[DEFAULT_REG_ENTRY_DATA_LEN];
FormatFullRegPath(tcaFullRegPath, TBUF_SIZEOF(tcaFullRegPath), lpzSubKey);
@ -99,7 +99,7 @@ BOOL UsbDkRegAccess::ReadDWord(LPCTSTR lpzValueName,
{
if (RegQueryValueEx(hkReadKeyHandle,
lpzValueName,
NULL,
nullptr,
&dwType,
(LPBYTE)&dwValue,
&dwSize) == ERROR_SUCCESS)
@ -124,7 +124,7 @@ DWORD UsbDkRegAccess::ReadString(LPCTSTR lpzValueName,
{
DWORD dwRes = 0;
DWORD dwType = REG_SZ;
HKEY hkReadKeyHandle = NULL;
HKEY hkReadKeyHandle = nullptr;
TCHAR tcaFullRegPath[DEFAULT_REG_ENTRY_DATA_LEN];
DWORD dwBuffSize = dwNumberOfElements * sizeof(lpzData[0]);
@ -140,7 +140,7 @@ DWORD UsbDkRegAccess::ReadString(LPCTSTR lpzValueName,
{
if (RegQueryValueEx(hkReadKeyHandle,
lpzValueName,
NULL,
nullptr,
&dwType,
(LPBYTE)lpzData,
&dwBuffSize) == ERROR_SUCCESS)
@ -161,7 +161,7 @@ LONG UsbDkRegAccess::ReadMultiString(LPCTSTR lpzValueName,
{
dwRes = 0;
DWORD dwType = REG_MULTI_SZ;
HKEY hkReadKeyHandle = NULL;
HKEY hkReadKeyHandle = nullptr;
TCHAR tcaFullRegPath[DEFAULT_REG_ENTRY_DATA_LEN];
DWORD dwBuffSize = dwNumberOfElements * sizeof(lpzData[0]);
@ -176,7 +176,7 @@ LONG UsbDkRegAccess::ReadMultiString(LPCTSTR lpzValueName,
if (errorCode == ERROR_SUCCESS)
{
errorCode = RegQueryValueEx(hkReadKeyHandle, lpzValueName, NULL, &dwType, (LPBYTE)lpzData, &dwBuffSize);
errorCode = RegQueryValueEx(hkReadKeyHandle, lpzValueName, nullptr, &dwType, (LPBYTE)lpzData, &dwBuffSize);
if (errorCode == ERROR_SUCCESS)
{
@ -197,7 +197,7 @@ DWORD UsbDkRegAccess::ReadBinary(LPCTSTR lpzValueName,
{
DWORD dwRes = 0;
DWORD dwType = REG_BINARY;
HKEY hkReadKeyHandle = NULL;
HKEY hkReadKeyHandle = nullptr;
TCHAR tcaFullRegPath[DEFAULT_REG_ENTRY_DATA_LEN];
memset(lpzData, 0, dwSize);
@ -212,7 +212,7 @@ DWORD UsbDkRegAccess::ReadBinary(LPCTSTR lpzValueName,
{
if (RegQueryValueEx(hkReadKeyHandle,
lpzValueName,
NULL,
nullptr,
&dwType,
lpzData,
&dwSize) == ERROR_SUCCESS)
@ -233,7 +233,7 @@ BOOL UsbDkRegAccess::ReadValueName(LPTSTR lpsValueName,
BYTE baData[DEFAULT_REG_ENTRY_DATA_LEN];
DWORD dwDataSize = DEFAULT_REG_ENTRY_DATA_LEN,
dwType = REG_BINARY;
HKEY hkReadKeyHandle = NULL;
HKEY hkReadKeyHandle = nullptr;
TCHAR tcaFullRegPath[DEFAULT_REG_ENTRY_DATA_LEN];
FormatFullRegPath(tcaFullRegPath, TBUF_SIZEOF(tcaFullRegPath), lpzSubKey);
@ -249,7 +249,7 @@ BOOL UsbDkRegAccess::ReadValueName(LPTSTR lpsValueName,
dwIndex,
lpsValueName,
&dwBuffSize,
NULL,
nullptr,
&dwType,
baData,
&dwDataSize) == ERROR_SUCCESS)
@ -266,7 +266,7 @@ BOOL UsbDkRegAccess::ReadKeyName(LPTSTR lpsKeyName,
LPCTSTR lpzSubKey)
{
BOOL bResult = FALSE;
HKEY hkReadKeyHandle = NULL;
HKEY hkReadKeyHandle = nullptr;
FILETIME stTimeFile;
TCHAR tcaFullRegPath[DEFAULT_REG_ENTRY_DATA_LEN];
@ -283,9 +283,9 @@ BOOL UsbDkRegAccess::ReadKeyName(LPTSTR lpsKeyName,
dwIndex,
lpsKeyName,
&dwBuffSize,
NULL,
NULL,
NULL,
nullptr,
nullptr,
nullptr,
&stTimeFile) == ERROR_SUCCESS)
bResult = TRUE;
RegCloseKey(hkReadKeyHandle);
@ -299,7 +299,7 @@ BOOL UsbDkRegAccess::WriteValue(LPCTSTR lpzValueName,
LPCTSTR lpzSubKey)
{
BOOL bResult = FALSE;
HKEY hkWriteKeyHandle = NULL;
HKEY hkWriteKeyHandle = nullptr;
TCHAR tcaFullRegPath[DEFAULT_REG_ENTRY_DATA_LEN];
DWORD dwDisposition;
@ -311,7 +311,7 @@ BOOL UsbDkRegAccess::WriteValue(LPCTSTR lpzValueName,
TEXT(""),
REG_OPTION_NON_VOLATILE,
KEY_WRITE,
NULL,
nullptr,
&hkWriteKeyHandle,
&dwDisposition) == ERROR_SUCCESS)
{
@ -333,7 +333,7 @@ BOOL UsbDkRegAccess::WriteString(LPCTSTR lpzValueName,
LPCTSTR lpzSubKey)
{
BOOL bResult = FALSE;
HKEY hkWriteKeyHandle = NULL;
HKEY hkWriteKeyHandle = nullptr;
TCHAR tcaFullRegPath[DEFAULT_REG_ENTRY_DATA_LEN];
DWORD dwDisposition;
@ -345,7 +345,7 @@ BOOL UsbDkRegAccess::WriteString(LPCTSTR lpzValueName,
TEXT(""),
REG_OPTION_NON_VOLATILE,
KEY_WRITE,
NULL,
nullptr,
&hkWriteKeyHandle,
&dwDisposition) == ERROR_SUCCESS)
{
@ -370,7 +370,7 @@ BOOL UsbDkRegAccess::WriteMultiString(LPCTSTR lpzValueName,
LPCTSTR lpzSubKey)
{
BOOL bResult = FALSE;
HKEY hkWriteKeyHandle = NULL;
HKEY hkWriteKeyHandle = nullptr;
TCHAR tcaFullRegPath[DEFAULT_REG_ENTRY_DATA_LEN];
DWORD dwDisposition;
@ -382,7 +382,7 @@ BOOL UsbDkRegAccess::WriteMultiString(LPCTSTR lpzValueName,
TEXT(""),
REG_OPTION_NON_VOLATILE,
KEY_WRITE,
NULL,
nullptr,
&hkWriteKeyHandle,
&dwDisposition) == ERROR_SUCCESS)
{
@ -408,7 +408,7 @@ BOOL UsbDkRegAccess::WriteBinary(LPCTSTR lpzValueName,
LPCTSTR lpzSubKey)
{
BOOL bResult = FALSE;
HKEY hkWriteKeyHandle = NULL;
HKEY hkWriteKeyHandle = nullptr;
TCHAR tcaFullRegPath[DEFAULT_REG_ENTRY_DATA_LEN];
DWORD dwDisposition;
@ -420,7 +420,7 @@ BOOL UsbDkRegAccess::WriteBinary(LPCTSTR lpzValueName,
TEXT(""),
REG_OPTION_NON_VOLATILE,
KEY_WRITE,
NULL,
nullptr,
&hkWriteKeyHandle,
&dwDisposition) == ERROR_SUCCESS)
{
@ -440,7 +440,7 @@ BOOL UsbDkRegAccess::WriteBinary(LPCTSTR lpzValueName,
BOOL UsbDkRegAccess::AddKey(LPCTSTR lpzKeyName)
{
BOOL bResult = FALSE;
HKEY hkWriteKeyHandle = NULL;
HKEY hkWriteKeyHandle = nullptr;
TCHAR tcaFullRegPath[DEFAULT_REG_ENTRY_DATA_LEN];
DWORD dwDisposition;
@ -452,7 +452,7 @@ BOOL UsbDkRegAccess::AddKey(LPCTSTR lpzKeyName)
TEXT(""),
REG_OPTION_NON_VOLATILE,
KEY_WRITE,
NULL,
nullptr,
&hkWriteKeyHandle,
&dwDisposition) == ERROR_SUCCESS)
{
@ -465,7 +465,7 @@ BOOL UsbDkRegAccess::AddKey(LPCTSTR lpzKeyName)
BOOL UsbDkRegAccess::DeleteKey(LPCTSTR lpzKeyName, LPCTSTR lpzSubKey)
{
BOOL bResult = FALSE;
HKEY hkDeleteKeyHandle = NULL;
HKEY hkDeleteKeyHandle = nullptr;
TCHAR tcaFullRegPath[DEFAULT_REG_ENTRY_DATA_LEN];
FormatFullRegPath(tcaFullRegPath, TBUF_SIZEOF(tcaFullRegPath), lpzSubKey);
@ -489,7 +489,7 @@ BOOL UsbDkRegAccess::DeleteKey(LPCTSTR lpzKeyName, LPCTSTR lpzSubKey)
BOOL UsbDkRegAccess::DeleteValue(LPCTSTR lpzValueName, LPCTSTR lpzSubKey)
{
BOOL bResult = FALSE;
HKEY hkDeleteKeyHandle = NULL;
HKEY hkDeleteKeyHandle = nullptr;
TCHAR tcaFullRegPath[DEFAULT_REG_ENTRY_DATA_LEN];
FormatFullRegPath(tcaFullRegPath, TBUF_SIZEOF(tcaFullRegPath), lpzSubKey);
@ -515,7 +515,7 @@ BOOL UsbDkRegAccess::GetValueInfo(LPCTSTR lpzValueName,
LPCTSTR lpzSubKey)
{
BOOL bRet = FALSE;
HKEY hkReadKeyHandle = NULL;
HKEY hkReadKeyHandle = nullptr;
TCHAR tcaFullRegPath[DEFAULT_REG_ENTRY_DATA_LEN];
FormatFullRegPath(tcaFullRegPath, TBUF_SIZEOF(tcaFullRegPath), lpzSubKey);
@ -528,9 +528,9 @@ BOOL UsbDkRegAccess::GetValueInfo(LPCTSTR lpzValueName,
{
if (RegQueryValueEx(hkReadKeyHandle,
lpzValueName,
NULL,
nullptr,
lpDataType,
NULL,
nullptr,
lpDataSize) == ERROR_SUCCESS)
bRet = TRUE;
@ -548,7 +548,7 @@ BOOL UsbDkRegAccess::GetKeyInfo(LPDWORD lpdwNofSubKeys,
LPCTSTR lpzSubKey)
{
BOOL bRet = FALSE;
HKEY hkReadKeyHandle = NULL;
HKEY hkReadKeyHandle = nullptr;
TCHAR tcaFullRegPath[DEFAULT_REG_ENTRY_DATA_LEN];
FormatFullRegPath(tcaFullRegPath, TBUF_SIZEOF(tcaFullRegPath), lpzSubKey);
@ -560,17 +560,17 @@ BOOL UsbDkRegAccess::GetKeyInfo(LPDWORD lpdwNofSubKeys,
&hkReadKeyHandle) == ERROR_SUCCESS)
{
if (RegQueryInfoKey(hkReadKeyHandle,
NULL,
NULL,
NULL,
nullptr,
nullptr,
nullptr,
lpdwNofSubKeys,
lpdwMaxSubKeyLen,
NULL,
nullptr,
lpdwNofValues,
lpdwMaxValueNameLen,
lpdwMaxValueLen,
NULL,
NULL) == ERROR_SUCCESS)
nullptr,
nullptr) == ERROR_SUCCESS)
bRet = TRUE;
RegCloseKey(hkReadKeyHandle);

View file

@ -30,60 +30,60 @@ public:
BOOL ReadValueName(LPTSTR lpsValueName,
DWORD dwNumberOfElements,
DWORD dwIndex=0,
LPCTSTR lpzSubKey=NULL);
LPCTSTR lpzSubKey=nullptr);
BOOL ReadKeyName(LPTSTR lpsKeyName,
DWORD dwNumberOfElements,
DWORD dwIndex,
LPCTSTR lpzSubKey = NULL);
LPCTSTR lpzSubKey = nullptr);
BOOL GetValueInfo(LPCTSTR lpzValueName,
DWORD* lpDataType,
DWORD* lpDataSize,
LPCTSTR lpzSubKey = NULL);
LPCTSTR lpzSubKey = nullptr);
BOOL GetKeyInfo(LPDWORD lpdwNofSubKeys,
LPDWORD lpdwMaxSubKeyLen,
LPDWORD lpdwNofValues,
LPDWORD lpdwMaxValueNameLen,
LPDWORD lpdwMaxValueLen,
LPCTSTR lpzSubKey = NULL);
LPCTSTR lpzSubKey = nullptr);
DWORD ReadDWord(LPCTSTR lpzValueName,
DWORD dwDefault = 0,
LPCTSTR lpzSubKey = NULL);
LPCTSTR lpzSubKey = nullptr);
BOOL ReadDWord(LPCTSTR lpzValueName,
LPDWORD lpdwValue,
LPCTSTR lpzSubKey = NULL);
LPCTSTR lpzSubKey = nullptr);
DWORD ReadString(LPCTSTR lpzValueName,
LPTSTR lpzData,
DWORD dwNumberOfElements,
LPCTSTR lpzSubKey=NULL);
LPCTSTR lpzSubKey=nullptr);
LONG ReadMultiString(LPCTSTR lpzValueName,
LPTSTR lpzData,
DWORD dwNumberOfElements,
DWORD &dwRes,
LPCTSTR lpzSubKey = NULL);
LPCTSTR lpzSubKey = nullptr);
DWORD ReadBinary(LPCTSTR lpzValueName,
LPBYTE lpzData,
DWORD dwSize,
LPCTSTR lpzSubKey=NULL);
LPCTSTR lpzSubKey=nullptr);
BOOL WriteValue(LPCTSTR lpzValueName,
DWORD dwValue,
LPCTSTR lpzSubKey = NULL);
LPCTSTR lpzSubKey = nullptr);
BOOL WriteString(LPCTSTR lpzValueName,
LPCTSTR lpzValue,
LPCTSTR lpzSubKey=NULL);
LPCTSTR lpzSubKey=nullptr);
BOOL WriteMultiString(LPCTSTR lpzValueName,
LPCTSTR lpzValue,
DWORD dwBuffSize,
LPCTSTR lpzSubKey = NULL);
LPCTSTR lpzSubKey = nullptr);
BOOL WriteBinary(LPCTSTR lpzValueName,
LPCBYTE lpData,
DWORD dwDataSize,
LPCTSTR lpzSubKey = NULL);
LPCTSTR lpzSubKey = nullptr);
BOOL DeleteKey(LPCTSTR lpzKeyName,
LPCTSTR lpzSubKey = NULL);
LPCTSTR lpzSubKey = nullptr);
BOOL DeleteValue(LPCTSTR lpzValueName,
LPCTSTR lpzSubKey = NULL);
LPCTSTR lpzSubKey = nullptr);
BOOL AddKey(LPCTSTR lpzKeyName);

View file

@ -5,7 +5,7 @@
ServiceManager::ServiceManager()
{
m_schSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
m_schSCManager = OpenSCManager(nullptr, nullptr, SC_MANAGER_ALL_ACCESS);
if (!m_schSCManager)
{
@ -16,7 +16,7 @@ ServiceManager::ServiceManager()
ServiceManager::~ServiceManager()
{
assert(NULL != m_schSCManager);
assert(nullptr != m_schSCManager);
CloseServiceHandle(m_schSCManager);
}
@ -24,12 +24,12 @@ ServiceManager::~ServiceManager()
void ServiceManager::CreateServiceObject(const tstring &ServiceName, const tstring &ServicePath)
{
assert(NULL != m_schSCManager);
assert(nullptr != m_schSCManager);
auto schService = CreateService(m_schSCManager, ServiceName.c_str(), ServiceName.c_str(), SERVICE_ALL_ACCESS, SERVICE_KERNEL_DRIVER,
SERVICE_DEMAND_START, SERVICE_ERROR_NORMAL, ServicePath.c_str(), NULL, NULL, NULL, NULL, NULL);
SERVICE_DEMAND_START, SERVICE_ERROR_NORMAL, ServicePath.c_str(), nullptr, nullptr, nullptr, nullptr, nullptr);
if (NULL == schService)
if (nullptr == schService)
{
throw UsbDkServiceManagerFailedException(TEXT("CreateService failed"));
}
@ -40,10 +40,10 @@ void ServiceManager::CreateServiceObject(const tstring &ServiceName, const tstri
void ServiceManager::DeleteServiceObject(const tstring &ServiceName)
{
assert(NULL != m_schSCManager);
assert(nullptr != m_schSCManager);
auto schService = OpenService(m_schSCManager, ServiceName.c_str(), SERVICE_ALL_ACCESS);
if (NULL == schService)
if (nullptr == schService)
{
auto err = GetLastError();
if (err != ERROR_SERVICE_DOES_NOT_EXIST)

View file

@ -36,7 +36,7 @@ void WdfCoinstaller::loadWdfCoinstaller()
m_wdfCoinstallerLibrary = LoadLibrary(coinstallerFullPath.str().c_str());
if (NULL == m_wdfCoinstallerLibrary)
if (nullptr == m_wdfCoinstallerLibrary)
{
throw UsbDkWdfCoinstallerFailedException(tstring(TEXT("LoadLibrary(")) + currDir + TEXT(") failed"));
}
@ -114,7 +114,7 @@ void WdfCoinstaller::freeWdfCoinstallerLibrary()
if (m_wdfCoinstallerLibrary)
{
FreeLibrary(m_wdfCoinstallerLibrary);
m_wdfCoinstallerLibrary = NULL;
m_wdfCoinstallerLibrary = nullptr;
}
}
//--------------------------------------------------------------------------------

View file

@ -40,7 +40,7 @@ private:
CallbackType getCoinstallerFunction(char *functionName)
{
auto ptfFunction = (CallbackType)GetProcAddress(m_wdfCoinstallerLibrary, functionName);
if (ptfFunction == NULL)
if (ptfFunction == nullptr)
{
throw UsbDkWdfCoinstallerFailedException(L"WdfCoinstaller throw the exception. GetProcAddress failed!");
}

View file

@ -8,7 +8,7 @@ string __wstring2string(const wstring& str)
char* buf = new (std::nothrow) char[buf_length];
size_t nCount;
if(NULL == buf)
if(nullptr == buf)
{
return string();
}
@ -29,7 +29,7 @@ wstring __string2wstring(const string& str)
wchar_t* buf = new (std::nothrow) wchar_t[buf_length];
size_t nCount;
if(NULL == buf)
if(nullptr == buf)
{
return wstring();
}