-
Notifications
You must be signed in to change notification settings - Fork 6
/
SharedMemory.h
73 lines (56 loc) · 1.76 KB
/
SharedMemory.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/*
* Created by SharpDevelop.
* User: frederik
* Date: 21/10/2012
* Time: 20:17
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
// MyClass.h
#pragma once
#include "Windows.h"
#include <windows.h>
#include <stdio.h>
#include <conio.h>
#include <tchar.h>
//using namespace System;
namespace SharedMemory {
struct SharedMemoryDescriptor {
HANDLE hSemaphore;
unsigned __int32 semaphoreLocked;
HANDLE hSharedMemory;
BYTE * data;
// These are stored in sharedmemory too:
//unsigned __int32 sharedMemorySize;
//unsigned __int32 highestByteWritten;
};
extern "C" _declspec(dllexport)
bool LockSharedMemory(HANDLE sharedMemoryHandle, unsigned __int32 timeoutInMilliseconds);
extern "C" _declspec(dllexport)
bool UnlockSharedMemory(HANDLE sharedMemoryHandle);
extern "C" _declspec(dllexport)
__int32 WriteSharedMemory( HANDLE sharedMemoryHandle, BYTE* data, unsigned __int32 length, unsigned __int32 offset );
extern "C" _declspec(dllexport)
__int32 ReadSharedMemory( HANDLE sharedMemoryHandle, BYTE * &pData );
extern "C" _declspec(dllexport)
__int32 WriteStringToSharedMemory( HANDLE sharedMemoryHandle, LPTSTR data );
extern "C" _declspec(dllexport)
LPTSTR ReadStringFromSharedMemory( HANDLE sharedMemoryHandle );
extern "C" _declspec(dllexport)
bool DestroySharedMemory(HANDLE sharedMemoryHandle);
extern "C" _declspec(dllexport)
HANDLE CreateSharedMemory(LPTSTR lpName, unsigned __int32 startSize, unsigned __int32 maxSize);
// struct ISharedMemory {
// virtual char* TestMethod() = 0;
// virtual void Release() = 0;
// };
/// <summary>
///
/// </summary>
// public ref class CSharedMemory {
// public:
// static char * GetSomeString() {
// return "hello, here's a string!!!";
// }
// };
}