Get data from a metatrader 4 alert - mql4

I use an indicator that generates alerts like: eur / USD Buy 1.122323, TP 1.131232, SL 1.114354, my question is how in an EA to read this data to execute the buy order.

cheat engine memory
using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
using Telegram.Bot;
namespace ConsoleApp45
{
class Program
{
const int PROCESS_WM_READ = 0x0010;
[DllImport("kernel32.dll")]
public static extern IntPtr OpenProcess(int dwDesiredAccess, bool bInheritHandle, int dwProcessId);
[DllImport("kernel32.dll")]
public static extern bool ReadProcessMemory(int hProcess,
int lpBaseAddress, byte[] lpBuffer, int dwSize, ref int lpNumberOfBytesRead);
public static void Main()
{
string ipek = "";
for (int i = 0; i < 10; i++)
{
Process process = Process.GetProcessesByName("terminal")[0];
IntPtr processHandle = OpenProcess(PROCESS_WM_READ, false, process.Id);
int bytesRead = 0;
byte[] buffer = new byte[10];
//02DD12A4 cheat engine den alınan değer 0x02DD12A4 bu şekilde girilir.
ReadProcessMemory((int)processHandle, 0x02DD12A4, buffer, buffer.Length, ref bytesRead);
string yasin = Encoding.UTF8.GetString(buffer);
}
}
}
}

Related

In Photon Bolt, how to send List of int data in a token along with event?

My codes:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Bolt;
using UdpKit;
//using System.Linq;
using System.Runtime.Serialization.Formatters.Binary;
using System.IO;
public class ListOfIntToken : IProtocolToken
{
public List<int> intList;
public int byteArraySize;
public void Read(UdpPacket packet)
{
byteArraySize = packet.ReadInt();
var objectBytes = packet.ReadByteArray(byteArraySize);
var mStream = new MemoryStream();
var binFormatter = new BinaryFormatter();
mStream.Write(objectBytes, 0, objectBytes.Length);
mStream.Position = 0;
intList = binFormatter.Deserialize(mStream) as List<int>;
}
public void Write(UdpPacket packet)
{
var binFormatter = new BinaryFormatter();
var mStream = new MemoryStream();
binFormatter.Serialize(mStream, intList);
//byte[] bytes = userId.Select(x => (byte)x).ToArray();
var byteArray = mStream.ToArray();
byteArraySize = byteArray.Length;
packet.WriteInt(byteArraySize);
packet.WriteByteArray(byteArray);
}
}
I have two clients running A and B. A is server. Both are sending the event with this token but with different data for testing. In Write method I print the byteArraySize out, and when the data are received on server I print them out too. The byteArraySize for A's data is 0, and the time it's printed is before the printing line inWrite method, where the size was 221. However for B's data the size was correct. What may causes this problem?
Final solution:
public void Read(UdpPacket packet)
{
intList.Clear();
if (packet.ReadBool()) // check if we have data to read
{
var total = packet.ReadInt();
for (int i = 0; i < total; i++)
{
intList.Add(packet.ReadInt());
}
}
}
public void Write(UdpPacket packet)
{
var total = intList.Count;
if (packet.WriteBool(total > 0)) // Write bool to signal we have some data
{
packet.WriteInt(total);
foreach (var item in intList)
{
packet.WriteInt(item);
}
}
}
The weird bug is caused by assigning to a wrong variable. It's been corrected in the question.

Enable broadcast on CFSocket in Xamarin.iOS

I need your help.
I have this Xamarin app, that is sending a multicast on the network using System.Net.UdpClient, but it seems pretty unstable and crashes a lot in background threads that I don't control. So I though why not go low-level.
Everything seems good except for the part of enabling the broadcast flag on the socket. In Objective-C you can do this:
setsockopt(CFSocketGetNative(cfSocket), SOL_SOCKET, SO_BROADCAST, (void *)&yes, sizeof(yes));
By looking at the mono source you'll see that the Socket class has an EnableBroadcast: https://github.com/mono/mono/blob/463cf3b5c1590df58fef43577b9a3273d5eece3d/mcs/class/System/System.Net.Sockets/Socket.cs#L195
Which inspired to this (very experimental) code:
public class NetworkHelper
{
[DllImport("libc", SetLastError = true)]
protected unsafe static extern int setsockopt(int s, int level, int optname, void* optval, uint optlen);
public unsafe static void DoMulticast()
{
var socket = new CFSocket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
var optval = 1;
var res = setsockopt(socket.Handle.ToInt32(), (int)SocketOptionLevel.Socket, (int)SocketOptionName.Broadcast, &optval, sizeof(int));
if (res < 0)
{
return;
}
}
}
It runs, but no matter what I change the setsockopt signature to, it returns -1.
TL;DR Do you think it's possible to enable the broadcast flag on a CFSocket (though Xamarin.iOS) done in the old CFNetwork.framework?
I've nailed it. I was missing the CFSocketNativeHandle like in the "native" Obj-C code, which I guess converts a CFNetwork->CFSocket into a native file descriptor pointer.
This is my full implementation (C# Extension):
public static class CFSocketExtensions
{
[DllImport(Constants.CoreFoundationLibrary)]
extern static nint CFSocketSendData(IntPtr handle, IntPtr address, IntPtr data, double timeout);
[DllImport("libc", SetLastError = true)]
extern static int setsockopt(CFSocketNativeHandle s, int level, int optname, IntPtr optval, int optlen);
[DllImport(Constants.CoreFoundationLibrary)]
extern static CFSocketNativeHandle CFSocketGetNative(IntPtr handle);
public static void SendData(this CFSocket socket, CFSocketAddress address, byte[] data, double timeout)
{
using (var buffer = new CFDataBuffer(data))
{
var error = (CFSocketError)(long)CFSocketSendData(socket.Handle, address.Handle, buffer.Handle, timeout);
if (error != CFSocketError.Success)
throw new CFSocketException(error);
}
}
public static bool EnableBroadcast(this CFSocket socket, bool enable = true)
{
int size = Marshal.SizeOf<int>();
IntPtr pBool = Marshal.AllocHGlobal(size);
Marshal.WriteInt32(pBool, 0, enable ? 1 : 0); // last parameter 0 (FALSE), 1 (TRUE)
var res = setsockopt(CFSocketGetNative(socket.Handle), (int)SocketOptionLevel.Socket, (int)SocketOptionName.Broadcast, pBool, size);
Marshal.FreeHGlobal(pBool);
return res > -1;
}
}
public class CFSocketAddress : CFDataBuffer
{
public CFSocketAddress(IPEndPoint endpoint)
: base(CreateData(endpoint))
{
}
internal static IPEndPoint EndPointFromAddressPtr(IntPtr address)
{
using (var buffer = new CFDataBuffer(address))
{
if (buffer[1] == 30)
{ // AF_INET6
int port = (buffer[2] << 8) + buffer[3];
var bytes = new byte[16];
Buffer.BlockCopy(buffer.Data, 8, bytes, 0, 16);
return new IPEndPoint(new IPAddress(bytes), port);
}
else if (buffer[1] == 2)
{ // AF_INET
int port = (buffer[2] << 8) + buffer[3];
var bytes = new byte[4];
Buffer.BlockCopy(buffer.Data, 4, bytes, 0, 4);
return new IPEndPoint(new IPAddress(bytes), port);
}
else
{
throw new ArgumentException();
}
}
}
static byte[] CreateData(IPEndPoint endpoint)
{
if (endpoint == null)
throw new ArgumentNullException("endpoint");
if (endpoint.AddressFamily == AddressFamily.InterNetwork)
{
var buffer = new byte[16];
buffer[0] = 16;
buffer[1] = 2; // AF_INET
buffer[2] = (byte)(endpoint.Port >> 8);
buffer[3] = (byte)(endpoint.Port & 0xff);
Buffer.BlockCopy(endpoint.Address.GetAddressBytes(), 0, buffer, 4, 4);
return buffer;
}
else if (endpoint.AddressFamily == AddressFamily.InterNetworkV6)
{
var buffer = new byte[28];
buffer[0] = 32;
buffer[1] = 30; // AF_INET6
buffer[2] = (byte)(endpoint.Port >> 8);
buffer[3] = (byte)(endpoint.Port & 0xff);
Buffer.BlockCopy(endpoint.Address.GetAddressBytes(), 0, buffer, 8, 16);
return buffer;
}
else
{
throw new ArgumentException();
}
}
}
public static class CFObject
{
[DllImport(Constants.CoreFoundationLibrary)]
internal extern static void CFRelease(IntPtr obj);
[DllImport(Constants.CoreFoundationLibrary)]
internal extern static IntPtr CFRetain(IntPtr obj);
}
public class CFData : INativeObject, IDisposable
{
internal IntPtr handle;
public CFData(IntPtr handle)
: this(handle, false)
{
}
public CFData(IntPtr handle, bool owns)
{
if (!owns)
CFObject.CFRetain(handle);
this.handle = handle;
}
~CFData()
{
Dispose(false);
}
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
public IntPtr Handle
{
get { return handle; }
}
[DllImport(Constants.CoreFoundationLibrary, EntryPoint = "CFDataGetTypeID")]
public extern static /* CFTypeID */ nint GetTypeID();
protected virtual void Dispose(bool disposing)
{
if (handle != IntPtr.Zero)
{
CFObject.CFRelease(handle);
handle = IntPtr.Zero;
}
}
public nint Length
{
get { return CFDataGetLength(handle); }
}
[DllImport(Constants.CoreFoundationLibrary)]
extern static /* CFIndex */ nint CFDataGetLength(/* CFDataRef */ IntPtr theData);
public byte[] GetBuffer()
{
var buffer = new byte[Length];
var ptr = CFDataGetBytePtr(handle);
Marshal.Copy(ptr, buffer, 0, buffer.Length);
return buffer;
}
[DllImport(Constants.CoreFoundationLibrary)]
extern static /* UInt8* */ IntPtr CFDataGetBytePtr(/* CFDataRef */ IntPtr theData);
/*
* Exposes a read-only pointer to the underlying storage.
*/
public IntPtr Bytes
{
get { return CFDataGetBytePtr(handle); }
}
[DllImport(Constants.CoreFoundationLibrary)]
extern static /* CFDataRef */ IntPtr CFDataCreate(/* CFAllocatorRef */ IntPtr allocator, /* UInt8* */ IntPtr bytes, /* CFIndex */ nint length);
public static CFData FromData(IntPtr buffer, nint length)
{
return new CFData(CFDataCreate(IntPtr.Zero, buffer, length), true);
}
[DllImport(Constants.CoreFoundationLibrary)]
extern static /* CFDataRef */ IntPtr CFDataCreateCopy(/* CFAllocatorRef */ IntPtr allocator, /* CFDataRef */ IntPtr theData);
public CFData Copy()
{
return new CFData(CFDataCreateCopy(IntPtr.Zero, Handle), true);
}
}
public class CFDataBuffer : IDisposable
{
byte[] buffer;
CFData data;
public CFDataBuffer(byte[] buffer)
{
this.buffer = buffer;
/*
* Copy the buffer to allow the native side to take ownership.
*/
//fixed (byte* ptr = buffer)
// data = CFData.FromData((IntPtr)ptr, buffer.Length);
GCHandle pinnedBuffer = GCHandle.Alloc(buffer, GCHandleType.Pinned);
data = CFData.FromData(pinnedBuffer.AddrOfPinnedObject(), buffer.Length);
pinnedBuffer.Free();
}
public CFDataBuffer(IntPtr ptr)
{
data = new CFData(ptr, false);
buffer = data.GetBuffer();
}
~CFDataBuffer()
{
Dispose(false);
}
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
public IntPtr Handle
{
get { return data.Handle; }
}
public byte[] Data
{
get { return buffer; }
}
public byte this[int idx]
{
get { return buffer[idx]; }
}
protected virtual void Dispose(bool disposing)
{
if (data != null)
{
data.Dispose();
data = null;
}
}
}
The only downside with this implementation is the CFSocketAddress, CFDataBuffer etc. which are defined as internal classes in the source.

Retrieving item text with JNA and SendMessage()

I am attempting to retrieve the item text from a Win32 ListView-like control. I am using JNA and SendMessageW() to send LVM_GETITEMTEXTW to the control. I have been successful at retrieving the item count (via LVM_GETITEMCOUNT) but am stumped at this point. My User32 class is setup like so:
public interface MyUser32 extends User32 {
MyUser32 INSTANCE = (MyUser32)Native.loadLibrary("user32", MyUser32.class);
LRESULT SendMessageW(HWND hWnd, int msg, WPARAM wParam, LVITEM lParam);
}
My LVITEM class is setup like so:
public class LVITEM extends Structure{
public LVITEM() {
pszText = new Memory(MEMSIZE);
cchTextMax = MEMSIZE;
}
private static final int MEMSIZE = 256;
public UINT mask;
public int iItem;
public int iSubItem;
public UINT state;
public UINT stateMask;
public Pointer pszText;
public int cchTextMax;
public int iImage;
public LPARAM lParam;
public int iIndent;
protected List<String> getFieldOrder() {
return Arrays.asList(new String[] { "mask", "iItem", "iSubItem", "state", "stateMask", "pszText", "cchTextMax", "iImage", "lParam", "iIndent"});
}
}
And the code that calls it all is like so:
MyUser32 u32 = MyUser32.INSTANCE;
LVITEM lvItem = new LVITEM();
WPARAM wPar = new WPARAM(1);
...
lvItem.iSubItem = 0;
res = u32.SendMessageW(handle, LVM_GETITEMTEXTW, wPar, lvItem);
System.out.println(res.intValue());
s = lvItem.pszText.getString(0);
System.out.println(s);
I've left out a bit of the code but I believe those are the important parts. My issue is that when I print out res.intValue() it is always 0 (meaning no text was returned) and when I print out the string value of pszText it is always some garbage characters. I'm completely stumped at this point so any suggestions are greatly appreciated. Thanks.

C# + Windows CE + Multiline & Align label

I need to make a multiline label with vertical and horizontal alignment and I don't know how I can do it !
I have found a way to make any control multiline with this function :
private const int BS_MULTILINE = 0x00002000;
private const int BS_CENTER = 0x00000300;
private const int BS_VCENTER = 0x00000C00;
private const int GWL_STYLE = -16;
[DllImport("coredll")]
private static extern int GetWindowLong(IntPtr hWnd, int nIndex);
[DllImport("coredll")]
private static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);
public static void MakeControlMultiline(Control control) {
IntPtr hwnd = control.Handle;
int currentStyle = GetWindowLong(hwnd, GWL_STYLE);
int newStyle = SetWindowLong(hwnd, GWL_STYLE, currentStyle | /*BS_CENTER | BS_VCENTER | */BS_MULTILINE);
}
The "BS_CENTER | BS_VCENTER" is in comment since it doesn't work !
So I try to make a customControl where I realise both alignments, like this :
public partial class ImproveLabel : Control {
...
protected override void OnPaint(PaintEventArgs pe) {
Graphics g = pe.Graphics;
// text
StringFormat drawFormat = new StringFormat();
drawFormat.Alignment = StringAlignment.Center;
drawFormat.LineAlignment = StringAlignment.Center;
g.DrawString(this.Text, this.Font, new SolidBrush(this.ForeColor), new Rectangle(0, 0, this.Width, this.Height), drawFormat);
// Calling the base class OnPaint
base.OnPaint(pe);
}
The strange thing here is that if I put both alignements to "Center", the multiline doesn't work anymore but if there is only the vertical alignment to "Center" and the horizontal alignment to "near", the multiline works.
I don't understand why it works this way but I need help to figure how I can get the 3 attributes working at the same time !
The code below is straight out of the P/Invoke SetWindowLong example.
private const int GWL_STYLE = -16;
private const int BS_CENTER = 0x00000300;
private const int BS_VCENTER = 0x00000C00;
private const int BS_MULTILINE = 0x00002000;
public static void SetButtonStyle(Button ctrl)
{
IntPtr hWnd;
int style;
// ctrl.Capture = true;
// hWnd = GetCapture();
// ctrl.Capture = false;
// Comment below and uncomment above if using Visual Studio 2003
hWnd = ctrl.Handle;
style = GetWindowLong(hWnd, GWL_STYLE);
SetWindowLong(hWnd, GWL_STYLE, (style | BS_CENTER | BS_VCENTER | BS_MULTILINE));
ctrl.Refresh();
}
It looks about exactly like yours, but I have not tested it personally.

How to disable a specific drive

I need to disable cdrom and the usb mass storage drivers using c# windows service. i have noticed there is a post Disable the use of CD drive (VB.NET) but it keeps ejecting the cdrom tray. does anyone know how to disable the cd rom other than using this method.????
On Vista and above you can use Group Policy settings to disable USB, CD-ROM and other types of removable storage. And you don't even need a service for that. If you cannot do this through group policy infrastructure, there is an option to set registry keys that Group Policy controls. Registry key locations are mentioned in this Vista forum post.
Check out VolumeManager defined below. It has functionality on locking volumes and disabling CD-ROM eject
public class VolumeManager
{
public string DriveLetter { private set; get; }
public IntPtr hFile { private set; get; }
public VolumeManager(string driveletter)
{
DriveLetter = driveletter;
}
public EjectState Eject()
{
if (!OpenHandle())
return EjectState.Failed;
if (Lock() && Dismount())
{
if (PreventRemoval(false) && AutoEject())
{
CloseHandle();
return EjectState.AutoEject;
}
else
{
CloseHandle();
return EjectState.RemoveSafely;
}
}
else
{
CloseHandle();
return EjectState.NoLock;
}
}
public bool OpenHandle()
{
string filename = "\\\\.\\" + DriveLetter + ":";
hFile = Win32.CreateFile(filename, Win32.GENERIC_READ | Win32.GENERIC_WRITE,
Win32.FILE_SHARE_READ | Win32.FILE_SHARE_WRITE, IntPtr.Zero, Win32.OPEN_EXISTING, 0, IntPtr.Zero);
if (hFile.ToInt32() == Win32.INVALID_HANDLE)
{
return false;
}
return true;
}
public void CloseHandle()
{
Win32.CloseHandle(hFile);
}
public bool Lock()
{
uint bytesReturned = 0;
int retry = 0;
while (retry < 20)
{
if (Win32.DeviceIoControl(hFile, Win32.FSCTL_LOCK_VOLUME, IntPtr.Zero, 0, IntPtr.Zero, 0,
ref bytesReturned, IntPtr.Zero))
{
return true;
}
System.Threading.Thread.Sleep(250);
retry++;
}
return false;
}
public bool Dismount()
{
uint bytesReturned = 0;
if (!Win32.DeviceIoControl(hFile, Win32.FSCTL_DISMOUNT_VOLUME, IntPtr.Zero, 0, IntPtr.Zero, 0,
ref bytesReturned, IntPtr.Zero))
{
return false;
}
return true;
}
public bool PreventRemoval(bool prevent)
{
Win32.PREVENT_MEDIA_REMOVAL pmr = new Win32.PREVENT_MEDIA_REMOVAL();
pmr.PreventMediaRemoval = prevent;
IntPtr ptr = Marshal.AllocHGlobal(Marshal.SizeOf(pmr));
Marshal.StructureToPtr(pmr, ptr, true);
uint bytesReturned = 0;
if (!Win32.DeviceIoControl(hFile, Win32.IOCTL_STORAGE_MEDIA_REMOVAL, ptr, Marshal.SizeOf(pmr), IntPtr.Zero, 0,
ref bytesReturned, IntPtr.Zero))
{
return false;
}
return true;
}
public bool AutoEject()
{
uint bytesReturned = 0;
if (!Win32.DeviceIoControl(hFile, Win32.IOCTL_STORAGE_EJECT_MEDIA, IntPtr.Zero, 0, IntPtr.Zero, 0,
ref bytesReturned, IntPtr.Zero))
{
return false;
}
return true;
}
}
public enum EjectState
{
Failed,
NoVolume,
NoLock,
RemoveSafely,
AutoEject
}
public class Win32
{
public const uint FILE_DEVICE_FILE_SYSTEM = 0x00000009;
public const uint IOCTL_STORAGE_BASE = 0x0000002d;
public const uint FILE_ANY_ACCESS = 0;
public const uint FILE_READ_ACCESS = 1;
public const uint METHOD_BUFFERED = 0;
public const uint FSCTL_LOCK_VOLUME = ((FILE_DEVICE_FILE_SYSTEM << 16) | (FILE_ANY_ACCESS << 14) | (6 << 2) | (METHOD_BUFFERED));
public const uint FSCTL_DISMOUNT_VOLUME = ((FILE_DEVICE_FILE_SYSTEM << 16) | (FILE_ANY_ACCESS << 14) | (8 << 2) | (METHOD_BUFFERED));
public const uint IOCTL_STORAGE_MEDIA_REMOVAL = ((IOCTL_STORAGE_BASE << 16) | (FILE_READ_ACCESS << 14) | (0x0201 << 2) | (METHOD_BUFFERED));
public const uint IOCTL_STORAGE_EJECT_MEDIA = ((IOCTL_STORAGE_BASE << 16) | (FILE_READ_ACCESS << 14) | (0x0202 << 2) | (METHOD_BUFFERED));
[DllImport("kernel32.dll", SetLastError = true)]
public static extern bool DeviceIoControl(IntPtr hDevice, uint dwIoControlCode, IntPtr lpInBuffer, int nInBufferSize,
IntPtr lpOutBuffer, uint nOutBufferSize, ref uint lpBytesReturned, IntPtr lpOverlapped);
[DllImport("kernel32.dll", SetLastError = true)]
public static extern bool CloseHandle(IntPtr hObject);
public const uint GENERIC_READ = 0x80000000;
public const uint GENERIC_WRITE = 0x40000000;
public const uint FILE_SHARE_READ = 0x00000001;
public const uint FILE_SHARE_WRITE = 0x00000002;
public const uint OPEN_EXISTING = 3;
public const int INVALID_HANDLE = -1;
[DllImport("kernel32.dll", SetLastError = true)]
public static extern IntPtr CreateFile(string lpFileName, uint dwDesiredAccess,
uint dwShareMode, IntPtr lpSecurityAttributes, uint dwCreationDisposition,
uint dwFlagsAndAttributes, IntPtr hTemplateFile);
public struct PREVENT_MEDIA_REMOVAL
{
[MarshalAs(UnmanagedType.Bool)]
public bool PreventMediaRemoval;
}
}
To disable CD-ROM eject:
string DriveLetter = "G"; // Or whatever letter you have assigned for your CD-ROM
var VolumeManager = new VolumeManager(DriveLetter);
if (VolumeManager.OpenHandle())
{
if (!VolumeManager.PreventRemoval(true))
{
// Failed to disable CD-ROM eject
VolumeManager.CloseHandle();
}
}
else
{
// Failed to access volume
}
I Have fund a solution
#region EjectMedia
const uint GENERICREAD = 0x80000000;
const uint OPENEXISTING = 3;
const uint IOCTL_STORAGE_EJECT_MEDIA = 2967560;
const int INVALID_HANDLE = -1;
private static IntPtr fileHandle;
private static uint returnedBytes;
[DllImport("kernel32", SetLastError = true)]
static extern IntPtr CreateFile(string fileName,
uint desiredAccess,
uint shareMode,
IntPtr attributes,
uint creationDisposition,
uint flagsAndAttributes,
IntPtr templateFile);
[DllImport("kernel32", SetLastError = true)]
static extern int CloseHandle(IntPtr driveHandle);
[DllImport("kernel32", SetLastError = true)]
static extern bool DeviceIoControl(IntPtr driveHandle,
uint IoControlCode,
IntPtr lpInBuffer,
uint inBufferSize,
IntPtr lpOutBuffer,
uint outBufferSize,
ref uint lpBytesReturned,
IntPtr lpOverlapped);
#endregion
private void loop(object sender, EventArgs e)
{
DriveInfo[] allDrives = DriveInfo.GetDrives();
foreach (DriveInfo d in allDrives)
{
if (d.IsReady)
{
if (d.DriveType == DriveType.Removable || d.DriveType == DriveType.Ram || d.DriveType == DriveType.Unknown)
Eject(#"\\.\" + d.Name.Substring(0, 1) + ":");
}
}
}
public void Eject(string driveLetter)
{
try
{
fileHandle = CreateFile(driveLetter, GENERICREAD, 0, IntPtr.Zero, OPENEXISTING, 0, IntPtr.Zero);
if ((int)fileHandle != INVALID_HANDLE)
DeviceIoControl(fileHandle, IOCTL_STORAGE_EJECT_MEDIA, IntPtr.Zero, 0, IntPtr.Zero, 0, ref returnedBytes, IntPtr.Zero);
}
catch
{
EventLog.WriteEntry(Marshal.GetLastWin32Error().ToString());
}
finally
{
CloseHandle(fileHandle);
fileHandle = IntPtr.Zero;
}
}

Resources