mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-05-16 14:41:03 +00:00
Update NamedSharedMemory.cs
This commit is contained in:
parent
82deec7a81
commit
c0c64de20d
|
@ -30,7 +30,7 @@ namespace WelsonJS
|
||||||
private IntPtr hFile;
|
private IntPtr hFile;
|
||||||
private IntPtr hFileMappingObject;
|
private IntPtr hFileMappingObject;
|
||||||
private string lpName;
|
private string lpName;
|
||||||
private static Dictionary<string, NamedSharedMemory> memDict = new Dictionary<string, NamedSharedMemory>();
|
private static Dictionary<string, NamedSharedMemory> memoryMap = new Dictionary<string, NamedSharedMemory>();
|
||||||
|
|
||||||
[Flags]
|
[Flags]
|
||||||
public enum FileProtection : uint
|
public enum FileProtection : uint
|
||||||
|
@ -95,10 +95,10 @@ namespace WelsonJS
|
||||||
|
|
||||||
public bool Open()
|
public bool Open()
|
||||||
{
|
{
|
||||||
if (memDict.ContainsKey(lpName))
|
if (memoryMap.ContainsKey(lpName))
|
||||||
{
|
{
|
||||||
hFile = memDict[lpName].hFile;
|
hFile = memoryMap[lpName].hFile;
|
||||||
hFileMappingObject = memDict[lpName].hFileMappingObject;
|
hFileMappingObject = memoryMap[lpName].hFileMappingObject;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@ namespace WelsonJS
|
||||||
{
|
{
|
||||||
hFile = FileMappingNative.CreateFileMapping((IntPtr)(-1), IntPtr.Zero, FileProtection.PAGE_READWRITE, 0u, 1024u, lpName);
|
hFile = FileMappingNative.CreateFileMapping((IntPtr)(-1), IntPtr.Zero, FileProtection.PAGE_READWRITE, 0u, 1024u, lpName);
|
||||||
hFileMappingObject = FileMappingNative.MapViewOfFile(hFile, FileMapAccess.FILE_MAP_ALL_ACCESS, 0u, 0u, 1024u);
|
hFileMappingObject = FileMappingNative.MapViewOfFile(hFile, FileMapAccess.FILE_MAP_ALL_ACCESS, 0u, 0u, 1024u);
|
||||||
memDict.Add(lpName, this);
|
memoryMap.Add(lpName, this);
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user