protected override void InternalValidate()
        {
            TaskLogger.LogEnter();
            ADForest localForest = ADForest.GetLocalForest();

            if (base.Fields.IsModified("Domain"))
            {
                this.adDomain = localForest.FindDomainByFqdn(this.Domain);
                if (this.adDomain == null)
                {
                    base.WriteError(new DomainNotFoundException(this.Domain), ErrorCategory.InvalidArgument, null);
                }
            }
            else
            {
                this.adDomain = localForest.FindLocalDomain();
            }
            string defaultOUForRecipient = RecipientTaskHelper.GetDefaultOUForRecipient(this.adDomain.Id);

            if (string.IsNullOrEmpty(defaultOUForRecipient))
            {
                base.WriteError(new ArgumentException(Strings.UsersContainerNotFound(this.adDomain.Fqdn, WellKnownGuid.UsersWkGuid)), ErrorCategory.InvalidArgument, null);
            }
            this.containerId = new ADObjectId(NativeHelpers.DistinguishedNameFromCanonicalName(defaultOUForRecipient));
            base.InternalValidate();
            TaskLogger.LogExit();
        }
        protected override IConfigurable PrepareDataObject()
        {
            base.PrepareDataObject();
            ITopologyConfigurationSession topologyConfigurationSession = (ITopologyConfigurationSession)base.DataSession;

            this.DataObject.Edition             = ServerEditionType.StandardEvaluation;
            this.DataObject.AdminDisplayVersion = ConfigurationContext.Setup.InstalledVersion;
            this.DataObject.VersionNumber       = SystemConfigurationTasksHelper.GenerateVersionNumber(ConfigurationContext.Setup.InstalledVersion);
            this.DataObject.MailboxRelease      = MailboxRelease.E15;
            if (string.IsNullOrEmpty(this.Name))
            {
                string localComputerFqdn = NativeHelpers.GetLocalComputerFqdn(true);
                int    num = localComputerFqdn.IndexOf('.');
                this.DataObject.Name = ((num == -1) ? localComputerFqdn : localComputerFqdn.Substring(0, num));
                NewExchangeServer.TcpNetworkAddress value = new NewExchangeServer.TcpNetworkAddress(NetworkProtocol.TcpIP, localComputerFqdn);
                this.DataObject.NetworkAddress = new NetworkAddressCollection(value);
            }
            this.DataObject.FaultZone = "FaultZone1";
            ADObjectId childId  = topologyConfigurationSession.GetAdministrativeGroupId().GetChildId("Servers");
            ADObjectId childId2 = childId.GetChildId(this.DataObject.Name);

            this.DataObject.SetId(childId2);
            this.DataObject.ExchangeLegacyDN = LegacyDN.GenerateLegacyDN(Server.GetParentLegacyDN(topologyConfigurationSession), this.DataObject);
            using (RegistryKey registryKey = RegistryUtil.OpenRemoteBaseKey(RegistryHive.LocalMachine, NativeHelpers.GetLocalComputerFqdn(true)))
            {
                using (RegistryKey registryKey2 = registryKey.OpenSubKey(NewExchangeServer.EdgeKeyName))
                {
                    if (registryKey2 == null && this.IsDomainJoined())
                    {
                        this.SetServerSiteInformation(topologyConfigurationSession);
                    }
                }
            }
            return(this.DataObject);
        }
        public NewPop3Configuration()
        {
            this.DataObject.Banner = "The Microsoft Exchange POP3 service is ready.";
            this.DataObject.UnencryptedOrTLSBindings = new MultiValuedProperty <IPBinding>(new IPBinding[]
            {
                new IPBinding("0.0.0.0:110"),
                new IPBinding("0000:0000:0000:0000:0000:0000:0.0.0.0:110")
            });
            this.DataObject.SSLBindings = new MultiValuedProperty <IPBinding>(new IPBinding[]
            {
                new IPBinding("0.0.0.0:995"),
                new IPBinding("0000:0000:0000:0000:0000:0000:0.0.0.0:995")
            });
            string localComputerFqdn = NativeHelpers.GetLocalComputerFqdn(false);

            if (!string.IsNullOrEmpty(localComputerFqdn))
            {
                this.DataObject.InternalConnectionSettings = new MultiValuedProperty <ProtocolConnectionSettings>(new ProtocolConnectionSettings[]
                {
                    new ProtocolConnectionSettings(localComputerFqdn + ":110:TLS"),
                    new ProtocolConnectionSettings(localComputerFqdn + ":995:SSL")
                });
            }
            this.DataObject.ProxyTargetPort = 1995;
        }
 public void StartAssiciatedProcessAndBringItToFront(string fileName, string fileNameMarker)
 {
     if (string.IsNullOrEmpty(fileName))
     {
         throw new ArgumentException();
     }
     _filenameMarker = fileNameMarker;
     try
     {
         Process.Start(fileName);
         if (!string.IsNullOrEmpty(_filenameMarker))
         {
             _buffer = IntPtr.Zero;
             _hwnd   = IntPtr.Zero;
             _buffer = Marshal.AllocHGlobal(512);
             NativeHelpers.EnumWindows(new NativeHelpers.EnumWindowsProc(searcher), IntPtr.Zero);
             if (_hwnd != IntPtr.Zero)
             {
                 BringToFront(_hwnd);
             }
         }
     }
     finally
     {
         if (_buffer != IntPtr.Zero)
         {
             Marshal.FreeHGlobal(_buffer);
             _buffer = IntPtr.Zero;
         }
         _hwnd           = IntPtr.Zero;
         _filenameMarker = null;
     }
 }
        private static string GetADDomainNameForServer(string serverFqdn)
        {
            if (string.IsNullOrEmpty(serverFqdn))
            {
                throw new ArgumentNullException("serverFqdn");
            }
            string text = null;

            try
            {
                text = NativeHelpers.GetPrimaryDomainInformationFromServer(serverFqdn);
            }
            catch (CannotGetDomainInfoException arg)
            {
                ExTraceGlobals.DnsTroubleshooterTracer.TraceError <string, CannotGetDomainInfoException>(0L, "{0} CannotGetDomainInfoException Error {1}", serverFqdn, arg);
            }
            catch (ADTransientException arg2)
            {
                ExTraceGlobals.DnsTroubleshooterTracer.TraceError <string, ADTransientException>(0L, "{0} ADTransientException Error {1}", serverFqdn, arg2);
            }
            if (string.IsNullOrEmpty(text))
            {
                text = serverFqdn.Substring(serverFqdn.IndexOf(".") + 1);
            }
            return(text);
        }
Beispiel #6
0
        public HmdMatrix44 GetEyeMatrix(HmdEye Eye)
        {
            CheckIfUsable();

            return(NativeHelpers.ConvertStruct <HmdMatrix44>(NativeMethods.VR_Hmd_GetEyeMatrix((int)Eye), Marshal.SizeOf(typeof(HmdMatrix44))));
            //return NativeHelpers.ConvertStructToClass<HmdMatrix44>(NativeMethods.VR_Hmd_GetEyeMatrix((int)Eye), Marshal.SizeOf(typeof(HmdMatrix44)));
        }
        public string GetFriendRichPresenceKeyByIndex(SteamID steamIDFriend, int key)
        {
            CheckIfUsable();
            IntPtr stringPtr = NativeMethods.Friends_GetFriendRichPresenceKeyByIndex(steamIDFriend.AsUInt64, key);

            return(NativeHelpers.ToStringUtf8(stringPtr));
        }
 protected override void OnSetActive(EventArgs e)
 {
     base.OnSetActive(e);
     if (!this.alreadySetActive)
     {
         this.alreadySetActive = true;
         bool           visible        = true;
         RoleCollection installedRoles = RoleManager.GetInstalledRoles();
         foreach (Role role in installedRoles)
         {
             if ((role.ServerRole == ServerRole.Edge || role.ServerRole == ServerRole.HubTransport || role.ServerRole == ServerRole.Mailbox) && string.IsNullOrEmpty(this.ServerName))
             {
                 this.ServerName = NativeHelpers.GetLocalComputerFqdn(false);
             }
             if (role.ServerRole == ServerRole.Edge)
             {
                 visible = false;
             }
         }
         this.commandConnectToServer.Visible = visible;
         if (string.IsNullOrEmpty(this.ServerName))
         {
             this.commandConnectToServer.Invoke();
         }
     }
 }
Beispiel #9
0
        public static string GetLastAviErrorMessage()
        {
            string error  = null;
            IntPtr buffer = IntPtr.Zero;

            try
            {
                byte[] errorMessage = new byte[200];
                buffer = Marshal.AllocHGlobal(errorMessage.Length + 1);
                Marshal.Copy(errorMessage, 0, buffer, errorMessage.Length);
                Marshal.WriteByte(buffer + errorMessage.Length, 0); // terminating null

                NativeHelpers.GetLastAviFileError(buffer);

                error = Marshal.PtrToStringAnsi(buffer);

                if (error != null)
                {
                    error = error.Trim();
                }
            }
            finally
            {
                if (buffer != IntPtr.Zero)
                {
                    Marshal.FreeHGlobal(buffer);
                }
            }

            return(error);
        }
Beispiel #10
0
 public static void StartNewAviFile(string fileName, int width, int height, int bpp, double fps, bool showCompressionDialog)
 {
     if (NativeHelpers.CreateNewAviFile(fileName, width, height, bpp, fps, showCompressionDialog) != 0)
     {
         TraceLastNativeError();
     }
 }
Beispiel #11
0
 public static void CloseAviFile()
 {
     if (NativeHelpers.AviFileClose() != 0)
     {
         TraceLastNativeError();
     }
 }
Beispiel #12
0
 public static void AddAviVideoFrame(int[,] pixels)
 {
     if (NativeHelpers.AviFileAddFrame(pixels) != 0)
     {
         TraceLastNativeError();
     }
 }
 internal static FileSystemAccessRule[] GetDomainWidePermissions()
 {
     FileSystemAccessRule[] result;
     try
     {
         NTAccount            ntaccount             = new NTAccount(NativeHelpers.GetDomainName() + "\\Organization Management");
         NTAccount            ntaccount2            = new NTAccount(NativeHelpers.GetDomainName() + "\\View-Only Organization Management");
         FileSystemAccessRule fileSystemAccessRule  = new FileSystemAccessRule(ntaccount.Translate(typeof(SecurityIdentifier)) as SecurityIdentifier, FileSystemRights.FullControl, InheritanceFlags.ContainerInherit | InheritanceFlags.ObjectInherit, PropagationFlags.None, AccessControlType.Allow);
         FileSystemAccessRule fileSystemAccessRule2 = new FileSystemAccessRule(ntaccount2.Translate(typeof(SecurityIdentifier)) as SecurityIdentifier, FileSystemRights.ReadAndExecute, InheritanceFlags.ContainerInherit | InheritanceFlags.ObjectInherit, PropagationFlags.None, AccessControlType.Allow);
         result = new FileSystemAccessRule[]
         {
             Database_Directory.builtInAdmin,
             Database_Directory.builtInLocalSystem,
             fileSystemAccessRule,
             fileSystemAccessRule2
         };
     }
     catch (Exception)
     {
         result = new FileSystemAccessRule[]
         {
             Database_Directory.builtInAdmin,
             Database_Directory.builtInLocalSystem
         };
     }
     return(result);
 }
Beispiel #14
0
        private void BufferSubData(int target, IntPtr offset, uint size, IntPtr ptr)
        {
            _boundBuffers.TryGetValue(target, out uint boundBuffer);
            var memoryName = $"DataBuffer{target}|{boundBuffer}";
            var offsetInt  = (int)offset;

            // It is assumed that the offset and size are valid per the already allocated buffer.
            // Check just in case.
            IntPtr wholeBuffer = UnmanagedMemoryAllocator.GetNamedMemory(memoryName, out int allocatedSize);

            if (offsetInt + size > allocatedSize)
            {
                Engine.Log.Error($"Invalid uploading sub data of {boundBuffer} in range {offsetInt}:{size}. Buffer is {allocatedSize} long.", "WebGLInternal");
                return;
            }

            // Update driver copy, in case of mapping. This could potentially be useless as mapping might not be used.
            NativeHelpers.MemCopy(ptr, IntPtr.Add(wholeBuffer, offsetInt), (int)size);

            var args = new BufferDataArgs
            {
                Ptr    = ptr,
                Target = target,
                Offset = offsetInt,
                Length = size
            };

            _gl.InvokeUnmarshalled <BufferDataArgs, object>("glBufferSubData", args);
        }
Beispiel #15
0
        private ADDomainTrustInfo[] FindTrustRelationships(string fqdn, QueryFilter filter)
        {
            ADObjectId            rootId = new ADObjectId("CN=System," + NativeHelpers.DistinguishedNameFromCanonicalName(fqdn));
            IConfigurationSession configurationSession = this.CreateDomainNcSession();

            return(configurationSession.Find <ADDomainTrustInfo>(rootId, QueryScope.SubTree, filter, null, 0));
        }
        protected override void InternalBeginProcessing()
        {
            TaskLogger.LogEnter();
            if (this.Credential != null)
            {
                base.NetCredential = this.Credential.GetNetworkCredential();
            }
            base.InternalBeginProcessing();
            base.WriteVerbose(Strings.VerboseIgnoreDefaultScope);
            this.domainRecipientSession = DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(base.DomainController, false, ConsistencyMode.PartiallyConsistent, base.NetCredential, base.OrgWideSessionSettings, 106, "InternalBeginProcessing", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\RecipientTasks\\recipient\\UpdateRecipient.cs");
            this.domainRecipientSession.EnforceDefaultScope = false;
            ADSessionSettings sessionSettings = ADSessionSettings.FromRootOrgScopeSet();

            if (!OrganizationId.ForestWideOrgId.Equals(base.OrgWideSessionSettings.CurrentOrganizationId))
            {
                sessionSettings = ADSessionSettings.FromAccountPartitionRootOrgScopeSet(base.OrgWideSessionSettings.CurrentOrganizationId.PartitionId);
            }
            this.configurationSession            = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(base.DomainController, true, ConsistencyMode.PartiallyConsistent, string.IsNullOrEmpty(base.DomainController) ? null : base.NetCredential, sessionSettings, 120, "InternalBeginProcessing", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\RecipientTasks\\recipient\\UpdateRecipient.cs");
            this.localForestLinkResolutionServer = ADSession.GetCurrentConfigDC(base.OrgWideSessionSettings.GetAccountOrResourceForestFqdn());
            string fqdn = NativeHelpers.CanonicalNameFromDistinguishedName(this.configurationSession.GetRootDomainNamingContextFromCurrentReadConnection());

            if (ADForest.IsLocalForestFqdn(fqdn) || !OrganizationId.ForestWideOrgId.Equals(base.OrgWideSessionSettings.CurrentOrganizationId))
            {
                this.domainRecipientSession.LinkResolutionServer = this.localForestLinkResolutionServer;
            }
            TaskLogger.LogExit();
        }
Beispiel #17
0
        /// <summary>
        /// Gets the icon of the achievement, which is a handle to be used in ISteamUtils::GetImageRGBA(), or 0 if none set.
        /// A return value of 0 may indicate we are still fetching data, and you can wait for the UserAchievementIconFetched_t callback
        /// which will notify you when the bits are ready. If the callback still returns zero, then there is no image set for the
        /// specified achievement.
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>

        /*
         * public AchievementIcon GetAchievementIcon(string name)
         * {
         *  CheckIfUsable();
         *  int value = NativeMethods.Stats_GetAchievementIcon(name);
         *  return new SteamTypes.AchievementIcon(value);
         * }
         */

        public string GetAchievementDisplayAttribute(string name, string key)
        {
            CheckIfUsable();
            IntPtr pointer = NativeMethods.Stats_GetAchievementDisplayAttribute(name, key);

            return(NativeHelpers.ToStringAnsi(pointer));
        }
Beispiel #18
0
        /// <summary>
        /// Handles a compare instruction
        /// </summary>
        /// <param name="condition">The condition</param>
        private void HandleCompare(CompilationData compilationData, Instruction instruction, int index, JumpCondition condition)
        {
            var generatedCode      = compilationData.Assembler.GeneratedCode;
            var unsignedComparison = this.GenerateComparision(compilationData, instruction, index);
            int compareJump        = generatedCode.Count;
            int jump             = 0;
            int trueBranchStart  = 0;
            int falseBranchStart = 0;

            int target = 0;

            compilationData.Assembler.Jump(condition, target, unsignedComparison);

            //Both branches will have the same operand entry, reserve space
            compilationData.OperandStack.ReserveSpace();

            //False branch
            falseBranchStart = generatedCode.Count;
            compilationData.OperandStack.PushInt(0, false);
            jump = generatedCode.Count;
            compilationData.Assembler.Jump(JumpCondition.Always, 0);

            //True branch
            trueBranchStart = generatedCode.Count;
            compilationData.OperandStack.PushInt(1, false);

            //Set the jump targets
            NativeHelpers.SetInt(generatedCode, jump + 1, generatedCode.Count - trueBranchStart);
            NativeHelpers.SetInt(generatedCode, compareJump + 2, trueBranchStart - falseBranchStart);
        }
Beispiel #19
0
        public string GetLeaderboardName(LeaderboardHandle handle)
        {
            CheckIfUsable();
            IntPtr pointer = NativeMethods.Stats_GetLeaderboardName(handle.AsUInt64);

            return(NativeHelpers.ToStringAnsi(pointer));
        }
Beispiel #20
0
        public HmdMatrix44 GetProjectionMatrix(HmdEye Eye, float NearZ, float FarZ, GraphicsAPIConvention ProjType)
        {
            CheckIfUsable();


            return(NativeHelpers.ConvertStruct <HmdMatrix44>(NativeMethods.VR_Hmd_GetProjectionMatrix((int)Eye, NearZ, FarZ, (int)ProjType), Marshal.SizeOf(typeof(HmdMatrix44))));
        }
Beispiel #21
0
        public bool Unpack(byte[] tag, byte[] plain)
        {
            byte[] internalBytes = NtagHelpers.GetInternalTag(tag);

            // Generate keys
            KeygenDerivedkeys dataKeys = GenerateKey(this.data, internalBytes);
            KeygenDerivedkeys tagKeys  = GenerateKey(this.tag, internalBytes);

            // Decrypt
            dataKeys.Cipher(internalBytes, plain, false);

            // Init OpenSSL HMAC context
            HMac hmacCtx = new HMac(new Sha256Digest());

            // Regenerate tag HMAC. Note: order matters, data HMAC depends on tag HMAC!
            hmacCtx.Init(new KeyParameter(tagKeys.hmacKey));
            hmacCtx.BlockUpdate(plain, 0x1D4, 0x34);
            hmacCtx.DoFinal(plain, HMAC_POS_TAG);

            // Regenerate data HMAC
            hmacCtx.Init(new KeyParameter(dataKeys.hmacKey));
            hmacCtx.BlockUpdate(plain, 0x029, 0x1DF);
            hmacCtx.DoFinal(plain, HMAC_POS_DATA);

            return
                (NativeHelpers.MemCmp(plain, internalBytes, HMAC_POS_DATA, 32) &&
                 NativeHelpers.MemCmp(plain, internalBytes, HMAC_POS_TAG, 32));
        }
        public void Input(KeyboardEvents kEvents, Keys currentKey)
        {
            if (visualStudioOnly && !NativeHelpers.ActiveApplTitle().Contains("Microsoft Visual Studio"))
            {
                return;
            }

            if (((kEvents == KeyboardEvents.SystemKeyDown) || (kEvents == KeyboardEvents.KeyDown)) &&
                currentKey.IsComboKey())
            {
                keyStates[currentKey] = true;
                isSystemKeyDown       = true;
            }
            if (((kEvents == KeyboardEvents.SystemKeyUp) || (kEvents == KeyboardEvents.KeyUp)) &&
                currentKey.IsComboKey())
            {
                keyStates[currentKey] = false;
                isSystemKeyDown       = AreAllSystemKeysDown(keyStates);
            }
            if (((kEvents == KeyboardEvents.SystemKeyDown) || (kEvents == KeyboardEvents.KeyDown)) &&
                (!currentKey.IsComboKey() && isSystemKeyDown))
            {
                ShortcutActivated(BuildKeyMessage(keyStates, currentKey));
            }
            else if ((kEvents == KeyboardEvents.KeyDown) && (currentKey.IsSpecialSingleKey() ||
                                                             currentKey.IsOtherKey()))
            {
                ShortcutActivated(BuildKeyMessage(keyStates, currentKey));
            }
        }
Beispiel #23
0
        private static IntPtr KeyboardHookProc(int code, IntPtr wParam, IntPtr lParam)
        {
            if (code < 0)
            {
                NativeHelpers.CallNextHookEx(((BaseHookSystem)GetHookSystem()).GetHookPtr(), code, wParam, lParam);
            }

            if (code == 0)
            {
                var focusHandle = NativeHelpers.GetFocus();
                var text        = NativeHelpers.GetText(focusHandle);
                System.Diagnostics.Debug.WriteLine($"Focused text: {text}");
                var automationElement = AutomationElement.FromHandle(focusHandle);
                System.Diagnostics.Debug.WriteLine($"Automated: {automationElement?.Current.Name}");

                Window window = (Window)HwndSource.FromHwnd(focusHandle).RootVisual;
                System.Diagnostics.Debug.WriteLine($"Window: {window?.Title}");

                if (window != null)
                {
                    var el = window.GetChildren <ToolBar>();
                }
            }

            return(NativeHelpers.CallNextHookEx(((BaseHookSystem)GetHookSystem()).GetHookPtr(), code, wParam, lParam));
        }
    private int searcher(IntPtr hWnd, IntPtr lParam)
    {
        int result;
        int ok = NativeHelpers.SendMessageTimeout(hWnd,
                                                  NativeHelpers.WM_GETTEXT,
                                                  new IntPtr(250),
                                                  _buffer,
                                                  NativeHelpers.SMTO_BLOCK | NativeHelpers.SMTO_ABORTIFHUNG,
                                                  100,
                                                  out result);

        if (ok == 0)
        {
            return(1);    // ignore this and continue
        }
        if (result > 0)
        {
            string windowName = Marshal.PtrToStringAuto(_buffer);
            if (windowName.Contains(_filenameMarker))
            {
                _hwnd = hWnd;
                return(0);    // stop search
            }
        }
        return(1);    // continue
    }
 protected bool Equals(KeygenDerivedkeys other)
 {
     return
         (NativeHelpers.MemCmp(aesKey, other.aesKey, 0, aesKey.Length) &&
          NativeHelpers.MemCmp(aesIV, other.aesIV, 0, aesIV.Length) &&
          NativeHelpers.MemCmp(hmacKey, other.hmacKey, 0, hmacKey.Length));
 }
Beispiel #26
0
        // Token: 0x06000461 RID: 1121 RVA: 0x0000FAD0 File Offset: 0x0000DCD0
        public static object ConvertValueFromString(object valueToConvert, Type resultType)
        {
            string text = valueToConvert as string;

            if (resultType.IsGenericType && resultType.GetGenericTypeDefinition() == typeof(Nullable <>))
            {
                bool flag = text == null || "null".Equals(text, StringComparison.OrdinalIgnoreCase) || "$null".Equals(text, StringComparison.OrdinalIgnoreCase);
                if (flag)
                {
                    return(null);
                }
            }
            if (resultType.Equals(typeof(ADObjectId)) && !string.IsNullOrEmpty(text) && !ADObjectId.IsValidDistinguishedName(text))
            {
                try
                {
                    text = NativeHelpers.DistinguishedNameFromCanonicalName(text);
                }
                catch (NameConversionException)
                {
                    throw new FormatException(DirectoryStrings.InvalidDNFormat(text));
                }
            }
            if (!resultType.Equals(typeof(bool)) && !resultType.Equals(typeof(bool?)))
            {
                return(LanguagePrimitives.ConvertTo(text, resultType));
            }
            if (text == null)
            {
                return(false);
            }
            return(bool.Parse(text));
        }
Beispiel #27
0
        private IntPtr GetString(int paramId)
        {
            var stringGetMemoryName = $"glGetString{paramId}";

            // Check if already gotten and allocated memory for it.
            IntPtr ptr = UnmanagedMemoryAllocator.GetNamedMemory(stringGetMemoryName, out int _);

            if (ptr != IntPtr.Zero)
            {
                return(ptr);
            }

            // Extensions are gotten from another function.
            string value;

            if (paramId == (int)StringName.Extensions)
            {
                value = _gl.InvokeUnmarshalled <string>("GetGLExtensions");
            }
            else
            {
                value = _gl.InvokeUnmarshalled <int, string>("glGet", paramId);
            }

            //Engine.Log.Trace($"String query {(StringName) paramId} got {value}", "WebGLInternal");
            ptr = NativeHelpers.StringToPtr(value);
            UnmanagedMemoryAllocator.RegisterAllocatedMemory(ptr, stringGetMemoryName, value.Length * sizeof(char));
            return(ptr);
        }
Beispiel #28
0
 private void SetHook()
 {
     using (ProcessModule module = Process.GetCurrentProcess().MainModule)
     {
         _hhook = NativeHelpers.SetWindowsHookEx(GetHookType(), GetCallback(), IntPtr.Zero, NativeHelpers.GetCurrentThreadId());
     }
 }
 public string GetQueryAddressString()
 {
     using (NativeBuffer buffer = NativeBuffer.CopyToNative(this))
     {
         IntPtr stringPtr = NativeMethods.MatchmakingServerNetworkAddress_GetQueryString(buffer.UnmanagedMemory);
         return(NativeHelpers.ToStringAnsi(stringPtr));
     }
 }
 private static void BringToFront(IntPtr hwnd)
 {
     if (NativeHelpers.IsIconic(hwnd) != 0)
     {
         NativeHelpers.ShowWindowAsync(hwnd, NativeHelpers.SW_RESTORE);
     }
     NativeHelpers.SetForegroundWindow(hwnd);
 }