<?xml version='1.0' encoding="utf-8"?>
      <rss version='2.0'>
      <channel>
      <title>Форум на Исходниках.RU</title>
      <link>https://forum.sources.ru</link>
      <description>Форум на Исходниках.RU</description>
      <generator>Форум на Исходниках.RU</generator>
  	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=427198&amp;view=findpost&amp;p=3884509</guid>
        <pubDate>Sun, 08 Jan 2023 15:28:25 +0000</pubDate>
        <title>Изменение строки в реестре без перезагрузки</title>
        <link>https://forum.sources.ru/index.php?showtopic=427198&amp;view=findpost&amp;p=3884509</link>
        <description><![CDATA[Gonarh: <div class='tag-quote'><a class='tag-quote-link' href='https://forum.sources.ru/index.php?showtopic=427198&view=findpost&p=3868042'><span class='tag-quote-prefix'>Цитата</span></a> <span class='tag-quote__quote-info'>salieri &#064; <time class="tag-quote__quoted-time" datetime="2022-06-09T11:25:23+03:00">09.06.22, 08:25</time></span><div class='quote '>как с правами решить вопрос?</div></div><br>
Запускай свой софт от администратора. Маловероятно что получится, т.к. нужны права учётки под которой запущен System, если не ошибаюсь, но всё же.]]></description>
        <author>Gonarh</author>
        <category>Visual Basic: Общие вопросы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=427198&amp;view=findpost&amp;p=3868042</guid>
        <pubDate>Thu, 09 Jun 2022 08:25:23 +0000</pubDate>
        <title>Изменение строки в реестре без перезагрузки</title>
        <link>https://forum.sources.ru/index.php?showtopic=427198&amp;view=findpost&amp;p=3868042</link>
        <description><![CDATA[salieri: <div class='tag-quote'><a class='tag-quote-link' href='https://forum.sources.ru/index.php?showtopic=427198&view=findpost&p=3868020'><span class='tag-quote-prefix'>Цитата</span></a> <span class='tag-quote__quote-info'>Gonarh &#064; <time class="tag-quote__quoted-time" datetime="2022-06-09T05:41:59+00:00">09.06.22, 05:41</time></span><div class='quote '>Попробуй создать регфайл с изменением хклм, если при помощи него изменения вносятся, 100% не хватает прав.</div></div><br>
да, сделал, всё работает&#33;<br>
как с правами решить вопрос?]]></description>
        <author>salieri</author>
        <category>Visual Basic: Общие вопросы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=427198&amp;view=findpost&amp;p=3868020</guid>
        <pubDate>Thu, 09 Jun 2022 05:41:59 +0000</pubDate>
        <title>Изменение строки в реестре без перезагрузки</title>
        <link>https://forum.sources.ru/index.php?showtopic=427198&amp;view=findpost&amp;p=3868020</link>
        <description><![CDATA[Gonarh: <div class='tag-quote'><a class='tag-quote-link' href='https://forum.sources.ru/index.php?showtopic=427198&view=findpost&p=3868010'><span class='tag-quote-prefix'>Цитата</span></a> <span class='tag-quote__quote-info'>salieri &#064; <time class="tag-quote__quoted-time" datetime="2022-06-08T20:42:55+00:00">08.06.22, 20:42</time></span><div class='quote '>дело только в том, что раздел HKCU меняется без вопросов, а HKLM не получается изменить программно</div></div><br>
Попробуй создать регфайл с изменением хклм, если при помощи него изменения вносятся, 100% не хватает прав.]]></description>
        <author>Gonarh</author>
        <category>Visual Basic: Общие вопросы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=427198&amp;view=findpost&amp;p=3868010</guid>
        <pubDate>Wed, 08 Jun 2022 20:42:55 +0000</pubDate>
        <title>Изменение строки в реестре без перезагрузки</title>
        <link>https://forum.sources.ru/index.php?showtopic=427198&amp;view=findpost&amp;p=3868010</link>
        <description><![CDATA[salieri: <div class='tag-quote'><a class='tag-quote-link' href='https://forum.sources.ru/index.php?showtopic=427198&view=findpost&p=3867789'><span class='tag-quote-prefix'>Цитата</span></a> <span class='tag-quote__quote-info'>Gonarh &#064; <time class="tag-quote__quoted-time" datetime="2022-06-08T05:32:36+00:00">08.06.22, 05:32</time></span><div class='quote '>Гугли в сторону <a class='tag-url' href='https://docs.microsoft.com/en-us/windows/wi...ia/audio-mixers' target='_blank'>https://docs.microsoft.com/en-us/windows/wi...ia/audio-mixers</a></div></div><br>
целый день сегодня просидел, как говорится, без бутылки не разобраться...<br>
гораздо проще в реестре поменять<br>
для моей задачи - это более чем достаточно<br>
дело только в том, что раздел HKCU меняется без вопросов, а HKLM не получается изменить программно]]></description>
        <author>salieri</author>
        <category>Visual Basic: Общие вопросы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=427198&amp;view=findpost&amp;p=3867789</guid>
        <pubDate>Wed, 08 Jun 2022 05:32:36 +0000</pubDate>
        <title>Изменение строки в реестре без перезагрузки</title>
        <link>https://forum.sources.ru/index.php?showtopic=427198&amp;view=findpost&amp;p=3867789</link>
        <description><![CDATA[Gonarh: <div class='tag-quote'><a class='tag-quote-link' href='https://forum.sources.ru/index.php?showtopic=427198&view=findpost&p=3865493'><span class='tag-quote-prefix'>Цитата</span></a> <span class='tag-quote__quote-info'>salieri &#064; <time class="tag-quote__quoted-time" datetime="2022-05-10T12:28:44+00:00">10.05.22, 12:28</time></span><div class='quote '>Я хочу микрофон отключить через реестр.</div></div><br>
Удаление гланд через анус. Так микрофон не отключают. Гугли в сторону <a class='tag-url' href='https://docs.microsoft.com/en-us/windows/win32/multimedia/audio-mixers' target='_blank'>https://docs.microsoft.com/en-us/windows/wi...ia/audio-mixers</a>]]></description>
        <author>Gonarh</author>
        <category>Visual Basic: Общие вопросы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=427198&amp;view=findpost&amp;p=3867781</guid>
        <pubDate>Tue, 07 Jun 2022 21:44:13 +0000</pubDate>
        <title>Изменение строки в реестре без перезагрузки</title>
        <link>https://forum.sources.ru/index.php?showtopic=427198&amp;view=findpost&amp;p=3867781</link>
        <description><![CDATA[salieri: <div class='tag-quote'><a class='tag-quote-link' href='https://forum.sources.ru/index.php?showtopic=427198&view=findpost&p=3865881'><span class='tag-quote-prefix'>Цитата</span></a> <span class='tag-quote__quote-info'>PeterS &#064; <time class="tag-quote__quoted-time" datetime="2022-05-17T10:03:25+00:00">17.05.22, 10:03</time></span><div class='quote '>А в какой именно Windows работаете с реестром?</div></div><br>
WIN10 LTSC 1809 RUS x64]]></description>
        <author>salieri</author>
        <category>Visual Basic: Общие вопросы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=427198&amp;view=findpost&amp;p=3865881</guid>
        <pubDate>Tue, 17 May 2022 10:03:25 +0000</pubDate>
        <title>Изменение строки в реестре без перезагрузки</title>
        <link>https://forum.sources.ru/index.php?showtopic=427198&amp;view=findpost&amp;p=3865881</link>
        <description><![CDATA[PeterS: А в какой именно Windows работаете с реестром?]]></description>
        <author>PeterS</author>
        <category>Visual Basic: Общие вопросы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=427198&amp;view=findpost&amp;p=3865522</guid>
        <pubDate>Wed, 11 May 2022 06:43:32 +0000</pubDate>
        <title>Изменение строки в реестре без перезагрузки</title>
        <link>https://forum.sources.ru/index.php?showtopic=427198&amp;view=findpost&amp;p=3865522</link>
        <description><![CDATA[salieri: <div class='tag-quote'><a class='tag-quote-link' href='https://forum.sources.ru/index.php?showtopic=427198&view=findpost&p=3865518'><span class='tag-quote-prefix'>Цитата</span></a> <span class='tag-quote__quote-info'>Akina &#064; <time class="tag-quote__quoted-time" datetime="2022-05-11T04:59:39+00:00">11.05.22, 04:59</time></span><div class='quote '>после программного изменения значения ключа запускаю regedit.exe и смотрю значение</div></div><br>
именно так и делаю&#33;]]></description>
        <author>salieri</author>
        <category>Visual Basic: Общие вопросы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=427198&amp;view=findpost&amp;p=3865518</guid>
        <pubDate>Wed, 11 May 2022 04:59:39 +0000</pubDate>
        <title>Изменение строки в реестре без перезагрузки</title>
        <link>https://forum.sources.ru/index.php?showtopic=427198&amp;view=findpost&amp;p=3865518</link>
        <description><![CDATA[Akina: <div class='tag-quote'><a class='tag-quote-link' href='https://forum.sources.ru/index.php?showtopic=427198&view=findpost&p=3865508'><span class='tag-quote-prefix'>Цитата</span></a> <span class='tag-quote__quote-info'>salieri &#064; <time class="tag-quote__quoted-time" datetime="2022-05-10T19:09:09+00:00">10.05.22, 19:09</time></span><div class='quote '>захожу в реестр и смотрю</div></div><br>
Весьма расплывчато и неопределённо. Вот если бы &quot;после программного изменения значения ключа запускаю regedit.exe и смотрю значение&quot;...]]></description>
        <author>Akina</author>
        <category>Visual Basic: Общие вопросы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=427198&amp;view=findpost&amp;p=3865508</guid>
        <pubDate>Tue, 10 May 2022 19:09:09 +0000</pubDate>
        <title>Изменение строки в реестре без перезагрузки</title>
        <link>https://forum.sources.ru/index.php?showtopic=427198&amp;view=findpost&amp;p=3865508</link>
        <description><![CDATA[salieri: <strong class='tag-b'>Akina</strong>, захожу в реестр и смотрю<br>
а как ещё?]]></description>
        <author>salieri</author>
        <category>Visual Basic: Общие вопросы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=427198&amp;view=findpost&amp;p=3865502</guid>
        <pubDate>Tue, 10 May 2022 16:29:11 +0000</pubDate>
        <title>Изменение строки в реестре без перезагрузки</title>
        <link>https://forum.sources.ru/index.php?showtopic=427198&amp;view=findpost&amp;p=3865502</link>
        <description><![CDATA[Akina: <div class='tag-quote'><a class='tag-quote-link' href='https://forum.sources.ru/index.php?showtopic=427198&view=findpost&p=3865493'><span class='tag-quote-prefix'>Цитата</span></a> <span class='tag-quote__quote-info'>salieri &#064; <time class="tag-quote__quoted-time" datetime="2022-05-10T12:28:44+00:00">10.05.22, 12:28</time></span><div class='quote '>а у меня не меняется&#33;</div></div><br>
А вот не верю. Полагаю, как-то не так проверяешь.]]></description>
        <author>Akina</author>
        <category>Visual Basic: Общие вопросы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=427198&amp;view=findpost&amp;p=3865493</guid>
        <pubDate>Tue, 10 May 2022 12:28:44 +0000</pubDate>
        <title>Изменение строки в реестре без перезагрузки</title>
        <link>https://forum.sources.ru/index.php?showtopic=427198&amp;view=findpost&amp;p=3865493</link>
        <description><![CDATA[salieri: Я хочу микрофон отключить через реестр.<br>
С помощью SetupAPI в диспетчере отключается, но всё равно работает. <br>
<br>
<span class="tag-color tag-color-named" data-value="mergepost" style="color: mergepost"><span class='tag-size' data-value='7' style='font-size:7pt;'>Добавлено <time class="tag-mergetime" datetime="2022-05-10T12:30:35+00:00">10.05.22, 12:30</time></span></span><br>
<div class='tag-quote'><a class='tag-quote-link' href='https://forum.sources.ru/index.php?showtopic=427198&view=findpost&p=3865491'><span class='tag-quote-prefix'>Цитата</span></a> <span class='tag-quote__quote-info'>Akina &#064; <time class="tag-quote__quoted-time" datetime="2022-05-10T11:38:40+00:00">10.05.22, 11:38</time></span><div class='quote '>Параметр в реестре меняется сразу, немедленно.</div></div><br>
а у меня не меняется&#33;<br>
в чём-то ошибка, значит...<br>
я уже весь интернет пересмотрел, разные пробовал варианты, не работает...]]></description>
        <author>salieri</author>
        <category>Visual Basic: Общие вопросы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=427198&amp;view=findpost&amp;p=3865491</guid>
        <pubDate>Tue, 10 May 2022 11:38:40 +0000</pubDate>
        <title>Изменение строки в реестре без перезагрузки</title>
        <link>https://forum.sources.ru/index.php?showtopic=427198&amp;view=findpost&amp;p=3865491</link>
        <description><![CDATA[Akina: Параметр в реестре меняется сразу, немедленно.<br><br>А вот чтобы он начал применяться - это вопросы к тому приложению/модулю, который использует значение из реестра. Если он при запуске прочитал и более не перечитывает - то вот хоть на пупе извернись, но без рестарта этого модуля новые значения не применить. А если приложение обращается к ОС, которая при своём старте либо при старте профиля прочитала и более не перечитывает - то не обойтись без рестарта того модуля ОС, который хранит прочитанное значение, при этом может потребоваться перевход профиля или даже рестарт всей ОС.]]></description>
        <author>Akina</author>
        <category>Visual Basic: Общие вопросы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=427198&amp;view=findpost&amp;p=3865465</guid>
        <pubDate>Tue, 10 May 2022 00:02:13 +0000</pubDate>
        <title>Изменение строки в реестре без перезагрузки</title>
        <link>https://forum.sources.ru/index.php?showtopic=427198&amp;view=findpost&amp;p=3865465</link>
        <description><![CDATA[salieri: Здравствуйте&#33;<br>
Необходимо изменить значение параметра в реестре без перезагрузки Windows.<br>
Пожалуйста, подскажите, что не так у меня.<br>
Ничего не меняется.<br>
<br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">Option Explicit</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; Private Const REG_SZ As Long = 1</div><div class="code_line">&nbsp;&nbsp; Private Const REG_DWORD As Long = 4</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; Private Const HKEY_CLASSES_ROOT = &amp;H80000000</div><div class="code_line">&nbsp;&nbsp; Private Const HKEY_CURRENT_USER = &amp;H80000001</div><div class="code_line">&nbsp;&nbsp; Private Const HKEY_LOCAL_MACHINE = &amp;H80000002</div><div class="code_line">&nbsp;&nbsp; Private Const HKEY_USERS = &amp;H80000003</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; Private Const ERROR_NONE = 0</div><div class="code_line">&nbsp;&nbsp; Private Const ERROR_BADDB = 1</div><div class="code_line">&nbsp;&nbsp; Private Const ERROR_BADKEY = 2</div><div class="code_line">&nbsp;&nbsp; Private Const ERROR_CANTOPEN = 3</div><div class="code_line">&nbsp;&nbsp; Private Const ERROR_CANTREAD = 4</div><div class="code_line">&nbsp;&nbsp; Private Const ERROR_CANTWRITE = 5</div><div class="code_line">&nbsp;&nbsp; Private Const ERROR_OUTOFMEMORY = 6</div><div class="code_line">&nbsp;&nbsp; Private Const ERROR_ARENA_TRASHED = 7</div><div class="code_line">&nbsp;&nbsp; Private Const ERROR_ACCESS_DENIED = 8</div><div class="code_line">&nbsp;&nbsp; Private Const ERROR_INVALID_PARAMETERS = 87</div><div class="code_line">&nbsp;&nbsp; Private Const ERROR_NO_MORE_ITEMS = 259</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; Private Const KEY_QUERY_VALUE = &amp;H1</div><div class="code_line">&nbsp;&nbsp; Private Const KEY_SET_VALUE = &amp;H2</div><div class="code_line">&nbsp;&nbsp; Private Const KEY_ALL_ACCESS = &amp;H3F</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;Private Const REG_OPTION_NON_VOLATILE = 0</div><div class="code_line">&nbsp;&nbsp; &nbsp;Private Const SE_PRIVILEGE_ENABLED &nbsp; &nbsp;As Long = 2&amp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;Private Const TOKEN_ADJUST_PRIVILEGES As Long = &amp;H20</div><div class="code_line">&nbsp;&nbsp; &nbsp;Private Const TOKEN_QUERY &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; As Long = 8&amp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;Private Const ERROR_NO_TOKEN &nbsp; &nbsp; &nbsp; &nbsp; As Long = 1008&amp;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;</div><div class="code_line">Private Type TOKEN_PRIVILEGES</div><div class="code_line">&nbsp;&nbsp; &nbsp;PrivilegeCount &nbsp;As Long</div><div class="code_line">&nbsp;&nbsp; &nbsp;LuidLowPart &nbsp; &nbsp; As Long</div><div class="code_line">&nbsp;&nbsp; &nbsp;LuidHighPart &nbsp; &nbsp;As Long</div><div class="code_line">&nbsp;&nbsp; &nbsp;Attributes &nbsp; &nbsp; &nbsp;As Long</div><div class="code_line">End Type</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;</div><div class="code_line">Private Declare Function LookupPrivilegeValue Lib &quot;advapi32.dll&quot; Alias &quot;LookupPrivilegeValueW&quot; (ByVal lpSystemName As Long, ByVal lpName As Long, lpLuid As Long) As Long</div><div class="code_line">Private Declare Function OpenProcessToken Lib &quot;advapi32.dll&quot; (ByVal ProcessHandle As Long, ByVal DesiredAccess As Long, TokenHandle As Long) As Long</div><div class="code_line">Private Declare Function OpenThreadToken Lib &quot;advapi32.dll&quot; (ByVal ThreadHandle As Long, ByVal DesiredAccess As Long, ByVal OpenAsSelf As Long, TokenHandle As Long) As Long</div><div class="code_line">Private Declare Function AdjustTokenPrivileges Lib &quot;advapi32.dll&quot; (ByVal TokenHandle As Long, ByVal DisableAllPrivileges As Long, NewState As TOKEN_PRIVILEGES, ByVal BufferLength As Long, ByVal PreviousState As Long, ByVal ReturnLength As Long) As Long</div><div class="code_line">Private Declare Function GetCurrentThread Lib &quot;kernel32.dll&quot; () As Long</div><div class="code_line">Private Declare Function GetCurrentProcess Lib &quot;kernel32.dll&quot; () As Long</div><div class="code_line">Private Declare Function CloseHandle Lib &quot;kernel32.dll&quot; (ByVal hObject As Long) As Long</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;</div><div class="code_line">Private Declare Function RegCloseKey Lib &quot;advapi32.dll&quot; (ByVal hKey As Long) As Long</div><div class="code_line">Private Declare Function RegCreateKeyEx Lib &quot;advapi32.dll&quot; Alias &quot;RegCreateKeyExA&quot; (ByVal hKey As Long, ByVal lpSubKey As String, ByVal Reserved As Long, ByVal lpClass As String, ByVal dwOptions As Long, ByVal samDesired As Long, ByVal lpSecurityAttributes As Long, phkResult As Long, lpdwDisposition As Long) As Long</div><div class="code_line">Private Declare Function RegOpenKeyEx Lib &quot;advapi32.dll&quot; Alias &quot;RegOpenKeyExA&quot; (ByVal hKey As Long, ByVal lpSubKey As String, ByVal ulOptions As Long, ByVal samDesired As Long, phkResult As Long) As Long</div><div class="code_line">Private Declare Function RegQueryValueExString Lib &quot;advapi32.dll&quot; Alias &quot;RegQueryValueExA&quot; (ByVal hKey As Long, ByVal lpValueName As String, ByVal lpReserved As Long, lpType As Long, ByVal lpData As String, lpcbData As Long) As Long</div><div class="code_line">Private Declare Function RegQueryValueExLong Lib &quot;advapi32.dll&quot; Alias &quot;RegQueryValueExA&quot; (ByVal hKey As Long, ByVal lpValueName As String, ByVal lpReserved As Long, lpType As Long, lpData As Long, lpcbData As Long) As Long</div><div class="code_line">Private Declare Function RegQueryValueExNULL Lib &quot;advapi32.dll&quot; Alias &quot;RegQueryValueExA&quot; (ByVal hKey As Long, ByVal lpValueName As String, ByVal lpReserved As Long, lpType As Long, ByVal lpData As Long, lpcbData As Long) As Long</div><div class="code_line">Private Declare Function RegSetValueExString Lib &quot;advapi32.dll&quot; Alias &quot;RegSetValueExA&quot; (ByVal hKey As Long, ByVal lpValueName As String, ByVal Reserved As Long, ByVal dwType As Long, ByVal lpValue As String, ByVal cbData As Long) As Long</div><div class="code_line">Private Declare Function RegSetValueExLong Lib &quot;advapi32.dll&quot; Alias &quot;RegSetValueExA&quot; (ByVal hKey As Long, ByVal lpValueName As String, ByVal Reserved As Long, ByVal dwType As Long, lpValue As Long, ByVal cbData As Long) As Long</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; Private Function SetValueEx(ByVal hKey As Long, sValueName As String, lType As Long, vValue As Variant) As Long</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; </div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; Dim lValue As Long</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; Dim sValue As String</div><div class="code_line">&nbsp;&nbsp; </div><div class="code_line">&nbsp;&nbsp; </div><div class="code_line">&nbsp;&nbsp; Select Case lType</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Case REG_SZ</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sValue = vValue &amp; Chr$(0)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SetValueEx = RegSetValueExString(hKey, sValueName, 0&amp;, lType, sValue, Len(sValue))</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Case REG_DWORD</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; lValue = vValue</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SetValueEx = RegSetValueExLong(hKey, sValueName, 0&amp;, lType, lValue, 4)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; End Select</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div><div class="code_line">&nbsp;&nbsp; End Function</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;</div><div class="code_line">Private Function SetCurrentProcessPrivileges(PrivilegeName As String) As Boolean</div><div class="code_line">&nbsp;&nbsp; &nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;Dim tp As TOKEN_PRIVILEGES, hToken&amp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;If LookupPrivilegeValue(0&amp;, StrPtr(PrivilegeName), tp.LuidLowPart) Then &nbsp; &#39;i.e. &quot;SeDebugPrivilege&quot;</div><div class="code_line">&nbsp;&nbsp; &nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;If 0 = OpenThreadToken(GetCurrentThread(), TOKEN_ADJUST_PRIVILEGES Or TOKEN_QUERY, 1&amp;, hToken) Then</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;If Err.LastDllError = ERROR_NO_TOKEN Then</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;If 0 = OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES Or TOKEN_QUERY, hToken) Then</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Exit Function</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;End If</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Else</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Exit Function</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;End If</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;End If</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;tp.PrivilegeCount = 1</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;tp.Attributes = SE_PRIVILEGE_ENABLED</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;SetCurrentProcessPrivileges = AdjustTokenPrivileges(hToken, 0&amp;, tp, 0&amp;, 0&amp;, 0&amp;)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;CloseHandle hToken</div><div class="code_line">&nbsp;&nbsp; &nbsp;End If</div><div class="code_line">End Function</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;</div><div class="code_line">Private Sub SetKeyValue(sKeyName As String, sValueName As String, vValueSetting As Variant, lValueType As Long)</div><div class="code_line">&nbsp;&nbsp; &nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;Dim lRetVal As Long &nbsp; &nbsp; &nbsp;&#39;result of the SetValueEx function</div><div class="code_line">&nbsp;&nbsp; &nbsp;Dim hKey As Long &nbsp; &nbsp; &nbsp; &nbsp; &#39;handle of open key</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;&#39;open the specified key</div><div class="code_line">&nbsp;&nbsp; &nbsp;lRetVal = RegOpenKeyEx(HKEY_LOCAL_MACHINE, sKeyName, 0, KEY_SET_VALUE, hKey)</div><div class="code_line">&nbsp;&nbsp; &nbsp;lRetVal = SetValueEx(hKey, sValueName, lValueType, vValueSetting)</div><div class="code_line">&nbsp;&nbsp; &nbsp;RegCloseKey (hKey)</div><div class="code_line">&nbsp;&nbsp; &nbsp;</div><div class="code_line">End Sub</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;</div><div class="code_line">Private Sub Form_Load()</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;SetCurrentProcessPrivileges &quot;SeBackupPrivilege&quot;</div><div class="code_line">&nbsp;&nbsp; &nbsp;SetCurrentProcessPrivileges &quot;SeRestorePrivilege&quot;</div><div class="code_line">&nbsp;&nbsp; &nbsp;SetCurrentProcessPrivileges &quot;SeTakeOwnershipPrivilege&quot;</div><div class="code_line">&nbsp;&nbsp; &nbsp;SetCurrentProcessPrivileges &quot;SeSecurityPrivilege&quot; &nbsp; &nbsp; &nbsp; &#39;SACL</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;SetKeyValue &quot;SOFTWARE\Microsoft\Windows\CurrentVersion\MMDevices\Audio\Capture\{877608b9-0609-4cf4-b714-3984ab0867c0}&quot;, &quot;xxx&quot;, &quot;Vasya&quot;, REG_SZ</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;</div><div class="code_line">End Sub</div></ol></div></div></div></div><script>preloadCodeButtons('1');</script>]]></description>
        <author>salieri</author>
        <category>Visual Basic: Общие вопросы</category>
      </item>
	
      </channel>
      </rss>
	