mirror of
https://github.com/Ryujinx/Opentk.git
synced 2024-12-23 01:45:29 +00:00
Merge pull request #630 from UnknownShadow200/develop
Allocate SystemDefaultCharSize instead of 1 byte per char for buffer used in WinGLNative.HandleDropFiles
This commit is contained in:
commit
feb8e8f6e3
|
@ -692,15 +692,15 @@ namespace OpenTK.Platform.Windows
|
|||
for (uint i = 0; i < filesCounter; ++i)
|
||||
{
|
||||
// Don't forget about \0 at the end
|
||||
uint fileNameSize = Functions.DragQueryFile(hDrop, i, IntPtr.Zero, 0) + 1;
|
||||
IntPtr str = Marshal.AllocHGlobal((int)fileNameSize);
|
||||
uint filenameChars = Functions.DragQueryFile(hDrop, i, IntPtr.Zero, 0) + 1;
|
||||
int filenameSize = (int)(filenameChars * Marshal.SystemDefaultCharSize);
|
||||
IntPtr str = Marshal.AllocHGlobal(filenameSize);
|
||||
|
||||
Functions.DragQueryFile(hDrop, i, str, fileNameSize);
|
||||
Functions.DragQueryFile(hDrop, i, str, filenameChars);
|
||||
|
||||
string dropString = Marshal.PtrToStringAuto(str);
|
||||
OnFileDrop(dropString);
|
||||
|
||||
Marshal.FreeHGlobal(str);
|
||||
OnFileDrop(dropString);
|
||||
}
|
||||
|
||||
Functions.DragFinish(hDrop);
|
||||
|
|
Loading…
Reference in a new issue