https://git.reactos.org/?p=reactos.git;a=commitdiff;h=a3629ab08b43e5935de6c6f518321f6f094dacbb

commit a3629ab08b43e5935de6c6f518321f6f094dacbb
Author:     Jérôme Gardou <[email protected]>
AuthorDate: Tue May 18 23:07:07 2021 +0200
Commit:     Jérôme Gardou <[email protected]>
CommitDate: Wed May 19 22:50:29 2021 +0200

    [RTL] SAL-annotate RtlUnicodeStringToCountedOemString
    
    Brought to you by Hermès
---
 sdk/include/ndk/rtlfuncs.h | 11 ++++++++---
 sdk/lib/rtl/unicode.c      | 12 ++++++++----
 2 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/sdk/include/ndk/rtlfuncs.h b/sdk/include/ndk/rtlfuncs.h
index 60e1308b964..c45bd9f35e8 100644
--- a/sdk/include/ndk/rtlfuncs.h
+++ b/sdk/include/ndk/rtlfuncs.h
@@ -1879,13 +1879,18 @@ RtlUnicodeStringToOemString(
     BOOLEAN AllocateDestinationString
 );
 
+_IRQL_requires_max_(PASSIVE_LEVEL)
+_Must_inspect_result_
 NTSYSAPI
 NTSTATUS
 NTAPI
 RtlUnicodeStringToCountedOemString(
-    _Inout_ POEM_STRING OemDest,
-    _In_ PCUNICODE_STRING UniSource,
-    _In_ BOOLEAN AllocateDestinationString);
+    _When_(AllocateDestinationString, _Out_ _At_(DestinationString->Buffer, 
__drv_allocatesMem(Mem)))
+    _When_(!AllocateDestinationString, _Inout_)
+        POEM_STRING DestinationString,
+    _In_ PCUNICODE_STRING SourceString,
+    _In_ BOOLEAN AllocateDestinationString
+);
 
 NTSYSAPI
 NTSTATUS
diff --git a/sdk/lib/rtl/unicode.c b/sdk/lib/rtl/unicode.c
index e1896497ce6..c7e85948f98 100644
--- a/sdk/lib/rtl/unicode.c
+++ b/sdk/lib/rtl/unicode.c
@@ -1784,14 +1784,18 @@ RtlHashUnicodeString(
  *
  * NOTES
  *  Same as RtlUnicodeStringToOemString but doesn't write terminating null
- *  Does a partial copy if the dest buffer is too small
  */
+_IRQL_requires_max_(PASSIVE_LEVEL)
+_Must_inspect_result_
+NTSYSAPI
 NTSTATUS
 NTAPI
 RtlUnicodeStringToCountedOemString(
-    IN OUT POEM_STRING OemDest,
-    IN PCUNICODE_STRING UniSource,
-    IN BOOLEAN AllocateDestinationString)
+    _When_(AllocateDestinationString, _Out_ _At_(DestinationString->Buffer, 
__drv_allocatesMem(Mem)))
+    _When_(!AllocateDestinationString, _Inout_)
+        POEM_STRING OemDest,
+    _In_ PCUNICODE_STRING UniSource,
+    _In_ BOOLEAN AllocateDestinationString)
 {
     NTSTATUS Status;
     ULONG Length;

Reply via email to