@@ -379,7 +379,7 @@ public static SafeHICON LoadImage_Icon([Optional] HINSTANCE hinst, SafeResourceI
379379 /// </returns>
380380 [ PInvokeData ( "WinUser.h" , MSDNShortId = "ms647486" ) ]
381381 [ DllImport ( Lib . User32 , CharSet = CharSet . Auto , SetLastError = true ) ]
382- [ System . Security . SecurityCritical ]
382+ [ System . Security . SecurityCritical , SuppressAutoGen ]
383383 public static extern int LoadString ( HINSTANCE hInstance , int uID , StringBuilder lpBuffer , int nBufferMax ) ;
384384
385385 /// <summary>Loads a string resource from the executable file associated with a specified module.</summary>
@@ -390,17 +390,16 @@ public static SafeHICON LoadImage_Icon([Optional] HINSTANCE hinst, SafeResourceI
390390 /// <param name="uID">The identifier of the string to be loaded.</param>
391391 /// <returns>If the function succeeds, the return value is the full resource string.</returns>
392392 [ PInvokeData ( "WinUser.h" , MSDNShortId = "ms647486" ) ]
393- public static string LoadString ( HINSTANCE hInstance , int uID )
393+ public static string ? LoadString ( HINSTANCE hInstance , int uID )
394394 {
395- IntPtr p = default ;
396- var l = LoadString ( hInstance , uID , p , 0 ) ;
395+ var l = LoadString ( hInstance , uID , out var p ) ;
397396 if ( l == 0 ) Win32Error . ThrowLastError ( ) ;
398- return StringHelper . GetString ( p , CharSet . Auto , l * Marshal . SystemDefaultCharSize ) ! ;
397+ return p ;
399398 }
400399
401400 [ DllImport ( Lib . User32 , CharSet = CharSet . Auto , SetLastError = true ) ]
402401 [ System . Security . SecurityCritical ]
403- private static extern int LoadString ( HINSTANCE hInstance , int uID , IntPtr lpBuffer , int nBufferMax ) ;
402+ private static extern int LoadString ( HINSTANCE hInstance , int uID , out StrPtrAuto lpBuffer , int nBufferMax = 0 ) ;
404403
405404 /// <summary/>
406405 [ StructLayout ( LayoutKind . Sequential , Pack = 1 ) ]
0 commit comments