https://git.reactos.org/?p=reactos.git;a=commitdiff;h=acf689a97365ae9cebdd6…
commit acf689a97365ae9cebdd653f3edcfab4a13f8d65
Author: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
AuthorDate: Sun Nov 24 21:51:22 2019 +0100
Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
CommitDate: Mon Nov 25 00:41:49 2019 +0100
[WIN32K] Use RtlString* routines.
---
win32ss/gdi/eng/device.c | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)
diff --git a/win32ss/gdi/eng/device.c b/win32ss/gdi/eng/device.c
index e5f30aa0bba..7691aad92f5 100644
--- a/win32ss/gdi/eng/device.c
+++ b/win32ss/gdi/eng/device.c
@@ -83,8 +83,7 @@ EngpPopulateDeviceModeList(
/* Some drivers like the VBox driver don't fill the dmDeviceName
with the name of the display driver. So fix that here. */
- wcsncpy(pdm->dmDeviceName, pwsz, CCHDEVICENAME);
- pdm->dmDeviceName[CCHDEVICENAME - 1] = 0;
+ RtlStringCbCopyW(pdm->dmDeviceName, sizeof(pdm->dmDeviceName), pwsz);
}
// FIXME: release the driver again until it's used?
@@ -205,14 +204,17 @@ EngpRegisterGraphicsDevice(
pGraphicsDevice->DeviceObject = pDeviceObject;
pGraphicsDevice->FileObject = pFileObject;
- /* Copy device name */
+ /* Copy the device name */
RtlStringCbCopyNW(pGraphicsDevice->szNtDeviceName,
- sizeof(pGraphicsDevice->szNtDeviceName),
- pustrDeviceName->Buffer,
- pustrDeviceName->Length);
-
- /* Create a win device name (FIXME: virtual devices!) */
- swprintf(pGraphicsDevice->szWinDeviceName, L"\\\\.\\DISPLAY%d",
(int)giDevNum);
+ sizeof(pGraphicsDevice->szNtDeviceName),
+ pustrDeviceName->Buffer,
+ pustrDeviceName->Length);
+
+ /* Create a Win32 device name (FIXME: virtual devices!) */
+ RtlStringCbPrintfW(pGraphicsDevice->szWinDeviceName,
+ sizeof(pGraphicsDevice->szWinDeviceName),
+ L"\\\\.\\DISPLAY%d",
+ (int)giDevNum);
/* Allocate a buffer for the strings */
cj = pustrDiplayDrivers->Length + pustrDescription->Length + sizeof(WCHAR);