internal static extern void RealTimeMultiplayerManager_SendUnreliableMessage( HandleRef self, /* from(RealTimeRoom_t) */IntPtr room, /* from(MultiplayerParticipant_t const *) */IntPtr[] participants, /* from(size_t) */UIntPtr participants_size, /* from(uint8_t const *) */byte[] data, /* from(size_t) */UIntPtr data_size);
public MemoryBlock(UIntPtr size) { size = (UIntPtr)(((long)size + 0xFFFFL) & ~0xFFFFL); this.size = size; location = VirtualAlloc((IntPtr)0, size, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE); security = MemoryBlockSecurity.ReadWrite; }
public static extern bool VirtualProtectEx( IntPtr hProcess , IntPtr lpAddress , UIntPtr dwSize , uint flNewProtect , out uint lpflOldProtect );
public IntPtr NativeCallback (IntPtr register_buffer, IntPtr content_buffer, IntPtr start, IntPtr end, out UIntPtr length, IntPtr user_data) { try { ulong mylength; byte [] __ret = managed (GLib.Object.GetObject(register_buffer) as Gtk.TextBuffer, GLib.Object.GetObject(content_buffer) as Gtk.TextBuffer, Gtk.TextIter.New (start), Gtk.TextIter.New (end), out mylength); length = new UIntPtr (mylength); IntPtr ret_ptr; if (mylength > 0) { ret_ptr = GLib.Marshaller.Malloc ((ulong)(Marshal.SizeOf (typeof(byte)) * (int)mylength)); Marshal.Copy (__ret, 0, ret_ptr, (int)mylength); } else { ret_ptr = IntPtr.Zero; } if (release_on_call) gch.Free (); return ret_ptr; } catch (Exception e) { GLib.ExceptionManager.RaiseUnhandledException (e, true); // NOTREACHED: Above call does not return. throw e; } }
public static void TestUseCase(Assert assert) { assert.Expect(7); var t1 = new Type(); assert.Ok(t1 != null, "#565 t1"); var t2 = new ValueType(); assert.Ok(t2 != null, "#565 t2"); var t3 = new IntPtr(); assert.Ok(t3.GetType() == typeof(IntPtr) , "#565 t3"); var t4 = new UIntPtr(); assert.Ok(t4.GetType() == typeof(UIntPtr), "#565 t4"); var t5 = new ParamArrayAttribute(); assert.Ok(t5 != null, "#565 t5"); var t6 = new RuntimeTypeHandle(); assert.Ok(t6.GetType() == typeof(RuntimeTypeHandle), "#565 t6"); var t7 = new RuntimeFieldHandle(); assert.Ok(t7.GetType() == typeof(RuntimeFieldHandle), "#565 t7"); }
public Streamcipher(BlockcipherKind algorithm, BlockcipherModeKind mode, int max_workers) { if (UnmanagedError.RegisterThread() != ErrorKind.K_ESUCCESS) throw new Exception("unable to register libk error handler"); if ((context = SafeNativeMethods.k_sc_init_with_blockcipher(algorithm, mode, (UIntPtr)max_workers)) == (UIntPtr)0) UnmanagedError.ThrowLastError(); }
public void SetDateTime (OciHandle handle, OciErrorHandle errorHandle, short year, byte month, byte day, byte hour, byte min, byte sec, uint fsec, string timezone) { // Get size of buffer ulong rsize = 0; UIntPtr rsizep = new UIntPtr (rsize); int status = OciCalls.OCIUnicodeToCharSet (handle, null, timezone, ref rsizep); // Fill buffer rsize = rsizep.ToUInt64 (); byte[] bytes = new byte[rsize]; if (status == 0 && rsize > 0) OciCalls.OCIUnicodeToCharSet (handle, bytes, timezone, ref rsizep); if (fsec > 0) fsec = fsec * 1000000; uint timezoneSize = (uint) bytes.Length; OciCalls.OCIDateTimeConstruct (handle, errorHandle, this.Handle, year, month, day, hour, min, sec, fsec, bytes, timezoneSize); //uint valid = 0; //int result = OciCalls.OCIDateTimeCheck (handle, // errorHandle, this.Handle, out valid); }
private IntPtr LowLevelKeyboardProc(int nCode, UIntPtr wParam, IntPtr lParam) { string chars = ""; try { if (nCode >= 0) if (wParam.ToUInt32() == (int)InterceptKeys.KeyEvent.WM_KEYDOWN || wParam.ToUInt32() == (int)InterceptKeys.KeyEvent.WM_KEYUP || wParam.ToUInt32() == (int)InterceptKeys.KeyEvent.WM_SYSKEYDOWN || wParam.ToUInt32() == (int)InterceptKeys.KeyEvent.WM_SYSKEYUP) { // Captures the character(s) pressed only on WM_KEYDOWN chars = InterceptKeys.VKCodeToString((uint)Marshal.ReadInt32(lParam), (wParam.ToUInt32() == (int)InterceptKeys.KeyEvent.WM_KEYDOWN || wParam.ToUInt32() == (int)InterceptKeys.KeyEvent.WM_SYSKEYDOWN)); hookedKeyboardCallbackAsync.BeginInvoke((InterceptKeys.KeyEvent)wParam.ToUInt32(), Marshal.ReadInt32(lParam), chars, null, null); } } catch (Exception e) { } return InterceptKeys.CallNextHookEx(hookId, nCode, wParam, lParam); }
public Log4JEventProperty(IntPtr name, UIntPtr nameSize, IntPtr value, UIntPtr valueSize) { Name = name; NameSize = nameSize; Value = value; ValueSize = valueSize; }
public static unsafe void TestCtor_VoidPointer_ToPointer() { void* pv = new UIntPtr(42).ToPointer(); VerifyPointer(new UIntPtr(pv), 42); VerifyPointer((UIntPtr)pv, 42); }
public static extern int RegQueryValueEx( UIntPtr hKey, string lpValueName, int lpReserved, out uint lpType, StringBuilder lpData, ref uint lpcbData);
private static extern IntPtr SendMessageTimeout(IntPtr hWnd, uint Msg, UIntPtr wParam, UIntPtr lParam, SendMessageTimeoutFlags fuFlags, uint uTimeout, out UIntPtr lpdwResult);
public MemoryBlock(UIntPtr start, long size) { #if !MONO Start = Kernel32.VirtualAlloc(start, checked((UIntPtr)size), Kernel32.AllocationType.RESERVE | Kernel32.AllocationType.COMMIT, Kernel32.MemoryProtection.NOACCESS); if (Start == UIntPtr.Zero) { throw new InvalidOperationException("VirtualAlloc() returned NULL"); } if (start != UIntPtr.Zero) End = (UIntPtr)((long)start + size); else End = (UIntPtr)((long)Start + size); Size = (long)End - (long)Start; #else Start = LibC.mmap(start, checked((UIntPtr)size), 0, LibC.MapType.MAP_ANONYMOUS, -1, IntPtr.Zero); if (Start == UIntPtr.Zero) { throw new InvalidOperationException("mmap() returned NULL"); } End = (UIntPtr)((long)Start + size); Size = (long)End - (long)Start; #endif }
public Hash(HashKind hashsum, int output_bits) { if (UnmanagedError.RegisterThread() != ErrorKind.K_ESUCCESS) throw new Exception("unable to register libk error handler"); if ((context = SafeNativeMethods.k_hash_init(hashsum, (uint)output_bits)) == (UIntPtr)0) UnmanagedError.ThrowLastError(); }
static extern bool WriteProcessMemory( IntPtr hProcess, IntPtr lpBaseAddress, string lpBuffer, UIntPtr nSize, out IntPtr lpNumberOfBytesWritten );
/// <summary> /// Private Constructor, only called by the getter for the InstalledDevices property. /// </summary> /// <param name="deviceId">Position of this device in the list of all devices.</param> /// <param name="caps">Win32 Struct with device metadata</param> private OutputDevice(UIntPtr deviceId, Win32API.MIDIOUTCAPS caps) : base(caps.szPname) { this.deviceId = deviceId; this.caps = caps; this.isOpen = false; }
/// <summary> /// The delegate with a signature that matches the native checkout progress_cb function's signature. /// </summary> /// <param name="str">The path that was updated.</param> /// <param name="completedSteps">The number of completed steps.</param> /// <param name="totalSteps">The total number of steps.</param> /// <param name="payload">Payload object.</param> private void OnGitCheckoutProgress(IntPtr str, UIntPtr completedSteps, UIntPtr totalSteps, IntPtr payload) { // Convert null strings into empty strings. string path = (str != IntPtr.Zero) ? Utf8Marshaler.FromNative(str) : string.Empty; onCheckoutProgress(path, (int)completedSteps, (int)totalSteps); }
public Streamcipher(StreamcipherKind algorithm, int noncebits) { if (UnmanagedError.RegisterThread() != ErrorKind.K_ESUCCESS) throw new Exception("unable to register libk error handler"); if ((context = SafeNativeMethods.k_sc_init(algorithm, (uint)noncebits)) == (UIntPtr)0) UnmanagedError.ThrowLastError(); }
public static byte[] PackRpcDefinition(NtRpcDefinition def, out UIntPtr packedLen) { WireEncoder enc = new WireEncoder(); enc.Write8((byte)def.Version); enc.WriteString(def.Name); int paramsSize = def.ParamsArray.Length; if (paramsSize > 0xff) paramsSize = 0xff; enc.Write8((byte)paramsSize); for (int i = 0; i < paramsSize; ++i) { enc.WriteType(def.ParamsArray[i].Value.Type); enc.WriteString(def.ParamsArray[i].Name); enc.WriteValue(def.ParamsArray[i].Value); } int resultsSize = def.ResultsArray.Length; if (resultsSize > 0xff) resultsSize = 0xff; enc.Write8((byte)resultsSize); for (int i = 0; i < resultsSize; ++i) { enc.WriteType(def.ResultsArray[i].Type); enc.WriteString(def.ResultsArray[i].Name); } packedLen = (UIntPtr)enc.Buffer.Length; return enc.Buffer; }
/// <include file='ManagedHooks.xml' path='Docs/KeyboardHook/HookCallback/*'/> protected override void HookCallback(int code, UIntPtr wparam, IntPtr lparam) { if (KeyboardEvent == null) { return; } int vkCode = 0; KeyboardEvents kEvent = (KeyboardEvents)wparam.ToUInt32(); if (kEvent != KeyboardEvents.KeyDown && kEvent != KeyboardEvents.KeyUp && kEvent != KeyboardEvents.SystemKeyDown && kEvent != KeyboardEvents.SystemKeyUp) { return; } GetKeyboardReading(wparam, lparam, ref vkCode); VirtualKeys vk = (VirtualKeys)vkCode; System.Windows.Forms.Keys key = ConvertKeyCode(vk); if (key == System.Windows.Forms.Keys.Attn) { return; } KeyboardEvent(kEvent, key); }
public static extern int RegNotifyChangeKeyValue( UIntPtr hKey, bool bWatchSubtree, uint dwNotifyFilter, SafeWaitHandle hEvent, bool fAsynchronous );
private int LineCallback(GitDiffDelta delta, GitDiffRange range, GitDiffLineOrigin lineorigin, IntPtr content, UIntPtr contentlen, IntPtr payload) { string decodedContent = Utf8Marshaler.FromNative(content, (int)contentlen); string prefix; switch (lineorigin) { case GitDiffLineOrigin.GIT_DIFF_LINE_ADDITION: LinesAdded++; prefix = Encoding.ASCII.GetString(new[] { (byte)lineorigin }); break; case GitDiffLineOrigin.GIT_DIFF_LINE_DELETION: LinesDeleted++; prefix = Encoding.ASCII.GetString(new[] { (byte)lineorigin }); break; case GitDiffLineOrigin.GIT_DIFF_LINE_CONTEXT: prefix = Encoding.ASCII.GetString(new[] { (byte)lineorigin }); break; default: prefix = string.Empty; break; } AppendToPatch(prefix); AppendToPatch(decodedContent); return 0; }
public static extern bool WriteProcessMemory( IntPtr hProcess, IntPtr lpBaseAddress, IntPtr lpBuffer, uint nSize, UIntPtr lpNumberOfBytesWritten );
public static UIntPtr KeyboardHook(int nCode, UIntPtr wParam, IntPtr lParam) { try { if (nCode == 0) { var wm = (WinAPI.WM)wParam.ToUInt32(); Mubox.WinAPI.WindowHook.KBDLLHOOKSTRUCT keyboardHookStruct = (Mubox.WinAPI.WindowHook.KBDLLHOOKSTRUCT)Marshal.PtrToStructure(lParam, typeof(Mubox.WinAPI.WindowHook.KBDLLHOOKSTRUCT)); if (OnKeyboardInputReceived(wm, keyboardHookStruct)) { return new UIntPtr(1); } } } catch (Exception ex) { ex.Log(); } try { return Mubox.WinAPI.WindowHook.CallNextHookEx(hHook, nCode, wParam, lParam); } catch (Exception ex) { ex.Log(); } return new UIntPtr(1); }
public static extern int RegOpenKeyEx( UIntPtr hKey, [MarshalAs(UnmanagedType.LPTStr)] string lpSubKey, uint ulOptions, uint samDesired, out UIntPtr phkResult );
private int HunkCallback(GitDiffDelta delta, GitDiffRange range, IntPtr header, UIntPtr headerlen, IntPtr payload) { string decodedContent = Utf8Marshaler.FromNative(header, (int)headerlen); AppendToPatch(decodedContent); return 0; }
static bool PlaySound ( byte [] ptrToSound, UIntPtr hmod, SoundFlags flags) { throw new System.NotImplementedException(); }
/// <summary> /// Override F1 to prevent it from getting to MSHTML. Will fire the HelpRequested /// event when the F1 key is pressed /// </summary> protected override IntPtr OnKeyHooked(int nCode, UIntPtr wParam, IntPtr lParam) { // only process HC_ACTION if (nCode == HC.ACTION) { // We want one key event per key key-press. To do this we need to // mask out key-down repeats and key-ups by making sure that bits 30 // and 31 of the lParam are NOT set. Bit 30 specifies the previous // key state. The value is 1 if the key is down before the message is // sent; it is 0 if the key is up. Bit 31 specifies the transition // state. The value is 0 if the key is being pressed and 1 if it is // being released. Therefore, we are only interested in key events // where both bits are set to 0. To test for both of these bits being // set to 0 we use the constant REDUNDANT_KEY_EVENT_MASK. const uint REDUNDANT_KEY_EVENT_MASK = 0xC0000000; if (((uint)lParam & REDUNDANT_KEY_EVENT_MASK) == 0) { // extract the keyCode and combine with modifier keys Keys keyCombo = ((Keys)(int)wParam & Keys.KeyCode) | KeyboardHelper.GetModifierKeys(); if (_tabs.CheckForTabSwitch(keyCombo)) return new IntPtr(1); } } // key not handled by our hook, continue processing return CallNextHook(nCode, wParam, lParam); }
private ExceptionDispatchInfo(Exception exception) { // Copy over the details we need to save. m_Exception = exception; #if MONO var count = exception.captured_traces == null ? 0 : exception.captured_traces.Length; var stack_traces = new System.Diagnostics.StackTrace [count + 1]; if (count != 0) Array.Copy (exception.captured_traces, 0, stack_traces, 0, count); stack_traces [count] = new System.Diagnostics.StackTrace (exception, 0, true); m_stackTrace = stack_traces; #else m_remoteStackTrace = exception.RemoteStackTrace; // NOTE: don't be tempted to pass the fields for the out params; the containing object // might be relocated during the call so the pointers will no longer be valid. object stackTrace; object dynamicMethods; m_Exception.GetStackTracesDeepCopy(out stackTrace, out dynamicMethods); m_stackTrace = stackTrace; m_dynamicMethods = dynamicMethods; m_IPForWatsonBuckets = exception.IPForWatsonBuckets; m_WatsonBuckets = exception.WatsonBuckets; #endif }
/// <summary> /// Sets a processor affinity mask for the current thread. /// </summary> /// <param name="mask">A thread affinity mask where each bit set to 1 specifies a logical processor on which this thread is allowed to run. /// <remarks>Note: a thread cannot specify a broader set of CPUs than those specified in the process affinity mask.</remarks> /// </param> /// <returns>The previous affinity mask for the current thread.</returns> public static UIntPtr SetThreadAffinityMask(UIntPtr mask) { UIntPtr lastaffinity = Win32Native.SetThreadAffinityMask(Win32Native.GetCurrentThread(), mask); if (lastaffinity == UIntPtr.Zero) throw new Win32Exception(Marshal.GetLastWin32Error()); return lastaffinity; }
public AddrinfoW(int Flags = default, int Family = default, int Socktype = default, int Protocol = default, System.UIntPtr Addrlen = default, ref ptr <ushort> Canonname = default, System.UIntPtr Addr = default, ref ptr <AddrinfoW> Next = default) { this.Flags = Flags; this.Family = Family; this.Socktype = Socktype; this.Protocol = Protocol; this.Addrlen = Addrlen; this.Canonname = Canonname; this.Addr = Addr; this.Next = Next; }
public static extern bool PlaySound ( string pszSound, System.UIntPtr hmod, uint fdwSound );
private static void fetch(this ptr <Link> _addr_ll, System.UIntPtr s) { ref Link ll = ref _addr_ll.val;
public static extern uint ZDICT_isError(size_t code);
public static extern uint ZSTD_isError(size_t code);
private static extern unsafe TF_Tensor TF_NewTensor(TFDataType dataType, IntPtr zeroDims, int num_dims, IntPtr data, size_t len, Deallocator deallocator, IntPtr deallocator_arg);
private static extern unsafe TF_Tensor TF_AllocateTensor(TFDataType dataType, IntPtr zeroDim, int num_dims, size_t len);
private static extern unsafe TF_Tensor TF_AllocateTensor(TFDataType dataType, long[] dims, int num_dims, size_t len);
public bucket(ref ptr <bucket> next = default, ref ptr <bucket> allnext = default, bucketType typ = default, System.UIntPtr hash = default, System.UIntPtr size = default, System.UIntPtr nstk = default) { this.next = next; this.allnext = allnext; this.typ = typ; this.hash = hash; this.size = size; this.nstk = nstk; }
public heapArena(array <byte> bitmap = default, array <ptr <mspan> > spans = default, array <byte> pageInUse = default, array <byte> pageMarks = default, array <byte> pageSpecials = default, System.UIntPtr zeroedBase = default) { this.bitmap = bitmap; this.spans = spans; this.pageInUse = pageInUse; this.pageMarks = pageMarks; this.pageSpecials = pageSpecials; this.zeroedBase = zeroedBase; }
public functab(System.UIntPtr entry = default, System.UIntPtr funcoff = default) { this.entry = entry; this.funcoff = funcoff; }
public moduledata(slice <byte> pclntable = default, slice <functab> ftab = default, slice <uint> filetab = default, System.UIntPtr findfunctab = default, System.UIntPtr minpc = default, System.UIntPtr maxpc = default, System.UIntPtr text = default, System.UIntPtr etext = default, System.UIntPtr noptrdata = default, System.UIntPtr enoptrdata = default, System.UIntPtr data = default, System.UIntPtr edata = default, System.UIntPtr bss = default, System.UIntPtr ebss = default, System.UIntPtr noptrbss = default, System.UIntPtr enoptrbss = default, System.UIntPtr end = default, System.UIntPtr gcdata = default, System.UIntPtr gcbss = default, System.UIntPtr types = default, System.UIntPtr etypes = default, slice <textsect> textsectmap = default, slice <int> typelinks = default, slice <ptr <itab> > itablinks = default, slice <ptabEntry> ptab = default, @string pluginpath = default, slice <modulehash> pkghashes = default, @string modulename = default, slice <modulehash> modulehashes = default, byte hasmain = default, bitvector gcdatamask = default, bitvector gcbssmask = default, map <typeOff, ptr <_type> > typemap = default, bool bad = default, ref ptr <moduledata> next = default) { this.pclntable = pclntable; this.ftab = ftab; this.filetab = filetab; this.findfunctab = findfunctab; this.minpc = minpc; this.maxpc = maxpc; this.text = text; this.etext = etext; this.noptrdata = noptrdata; this.enoptrdata = enoptrdata; this.data = data; this.edata = edata; this.bss = bss; this.ebss = ebss; this.noptrbss = noptrbss; this.enoptrbss = enoptrbss; this.end = end; this.gcdata = gcdata; this.gcbss = gcbss; this.types = types; this.etypes = etypes; this.textsectmap = textsectmap; this.typelinks = typelinks; this.itablinks = itablinks; this.ptab = ptab; this.pluginpath = pluginpath; this.pkghashes = pkghashes; this.modulename = modulename; this.modulehashes = modulehashes; this.hasmain = hasmain; this.gcdatamask = gcdatamask; this.gcbssmask = gcbssmask; this.typemap = typemap; this.bad = bad; this.next = next; }
public chantype(_type typ = default, ref ptr <_type> elem = default, System.UIntPtr dir = default) { this.typ = typ; this.elem = elem; this.dir = dir; }
private static extern unsafe size_t TF_StringEncode(byte *src, size_t src_len, sbyte *dst, size_t dst_len, TF_Status status);
public static extern size_t ZSTD_compressBound(size_t srcSize);
private static extern unsafe size_t TF_StringDecode(sbyte *src, size_t src_len, sbyte **dst, size_t *dst_len, TF_Status status);
public static extern size_t ZDICT_trainFromBuffer(byte[] dictBuffer, size_t dictBufferCapacity, byte[] samplesBuffer, size_t[] samplesSizes, uint nbSamples);
public stkframe(funcInfo fn = default, System.UIntPtr pc = default, System.UIntPtr continpc = default, System.UIntPtr lr = default, System.UIntPtr sp = default, System.UIntPtr fp = default, System.UIntPtr varp = default, System.UIntPtr argp = default, System.UIntPtr arglen = default, ref ptr <bitvector> argmap = default) { this.fn = fn; this.pc = pc; this.continpc = continpc; this.lr = lr; this.sp = sp; this.fp = fp; this.varp = varp; this.argp = argp; this.arglen = arglen; this.argmap = argmap; }
public static extern IntPtr ZDICT_getErrorName(size_t code);
public _defer(int siz = default, bool started = default, bool heap = default, bool openDefer = default, System.UIntPtr sp = default, System.UIntPtr pc = default, ref ptr <funcval> fn = default, ref ptr <_panic> _panic = default, ref ptr <_defer> link = default, unsafe.Pointer fd = default, System.UIntPtr varp = default, System.UIntPtr framepc = default)
public static extern uint vbyte_encode(uint[] @in, size_t length, byte[] bout);
public sigactiont(System.UIntPtr sa_handler = default, ulong sa_flags = default, System.UIntPtr sa_restorer = default, ulong sa_mask = default) { this.sa_handler = sa_handler; this.sa_flags = sa_flags; this.sa_restorer = sa_restorer; this.sa_mask = sa_mask; }
private static extern size_t TF_StringEncodedSize(size_t len);
private static (System.UIntPtr, error) getPagefileUsage() { System.UIntPtr _p0 = default; error _p0 = default !;
private static extern void mouse_event(MouseFlags dwFlags, int dx, int dy, int dwData, System.UIntPtr dwExtraInfo);
public rtype(System.UIntPtr size = default, System.UIntPtr ptrdata = default, uint hash = default, tflag tflag = default, byte align = default, byte fieldAlign = default, byte kind = default, Func <unsafe.Pointer, unsafe.Pointer, bool> equal = default, ref ptr <byte> gcdata = default, nameOff str = default, typeOff ptrToThis = default)
public TransmitFileBuffers(System.UIntPtr Head = default, uint HeadLength = default, System.UIntPtr Tail = default, uint TailLength = default) { this.Head = Head; this.HeadLength = HeadLength; this.Tail = Tail; this.TailLength = TailLength; }
public memRecordCycle(System.UIntPtr allocs = default, System.UIntPtr frees = default, System.UIntPtr alloc_bytes = default, System.UIntPtr free_bytes = default) { this.allocs = allocs; this.frees = frees; this.alloc_bytes = alloc_bytes; this.free_bytes = free_bytes; }
public arrayType(rtype rtype = default, ref ptr <rtype> elem = default, ref ptr <rtype> slice = default, System.UIntPtr len = default) { this.m_rtypeRef = new ptr <rtype>(rtype); this.elem = elem; this.slice = slice; this.len = len; }
public dirInfo(System.UIntPtr dir = default) { this.dir = dir; }