<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[HILFE bei MS-CODE-beispiel für Joystick OEM-Name]]></title><description><![CDATA[<p>Hiho</p>
<p>in der MSDN Lib hab ich folgende Routine für die Abfrage des Joysticknamens gefunden. Wenn ich diese allerdings benütze dann stoße ich auf folgende Fehlermeldung: EAccessValiation &quot;Zugriffsverletzung bei Addresse xyz in der ntdll.dll&quot;...</p>
<p>der Code schaut folgender Maßen aus:</p>
<pre><code>#include &quot;windows.h&quot;
#include &quot;mmsystem.h&quot;

MMRESULT joyGetOEMProductName(UINT id, TCHAR * pszName)
{
 JOYCAPS JoyCaps;
 TCHAR szKey[256];
 TCHAR szValue[256];
 UCHAR szOEMKey[256];
 HKEY hKey;
 DWORD dwcb;
 LONG lr;
// Note: JOYSTICKID1-16 is zero-based; registry entries for VJOYD are 1-based.
 id++;  
 if (id &gt; joyGetNumDevs() ) return JOYERR_NOCANDO;
// Open .. MediaResources\CurentJoystickSettings.
 joyGetDevCaps((id-1), &amp;JoyCaps, sizeof(JoyCaps));
 sprintf(szKey,
   &quot;%s\\%s\\%s&quot;,
   REGSTR_PATH_JOYCONFIG,
   JoyCaps.szRegKey,
   REGSTR_KEY_JOYCURR);
 lr = RegOpenKeyEx(HKEY_LOCAL_MACHINE, (LPTSTR) &amp;szKey, 0, KEY_ALL_ACCESS, &amp;hKey);
 if (lr != ERROR_SUCCESS) return JOYERR_NOCANDO;
// Get OEM Key name.
 dwcb = sizeof(szOEMKey);
  sprintf(szValue, &quot;Joystick%d%s&quot;, id, REGSTR_VAL_JOYOEMNAME);
 lr = RegQueryValueEx(hKey, szValue, 0, 0, (LPBYTE) &amp;szOEMKey, (LPDWORD) &amp;dwcb);
 RegCloseKey(hKey);
 if (lr != ERROR_SUCCESS)
 {
  *pszName = 0;
  return JOYERR_NOCANDO;
 }
// Open OEM Key from ...MediaProperties.
 sprintf(szKey, &quot;%s\\%s&quot;, REGSTR_PATH_JOYOEM, szOEMKey);
 lr = RegOpenKeyEx(HKEY_LOCAL_MACHINE, szKey, 0, KEY_ALL_ACCESS, &amp;hKey);
 if (lr != ERROR_SUCCESS) return JOYERR_NOCANDO;
// Get OEM Name.
 dwcb = sizeof(szValue);
 lr = RegQueryValueEx( hKey,
        REGSTR_VAL_JOYOEMNAME,
        0, 0,
        (LPBYTE) pszName,
        (LPDWORD) &amp;dwcb);
 RegCloseKey(hKey);
 if (lr != ERROR_SUCCESS)
  return JOYERR_NOCANDO;
 else
  return JOYERR_NOERROR;
}
</code></pre>
<p>Der Pointer steht dabei auf lr = RegQueryValueEx( hKey, REGSTR_VAL_JOYOEMNAME, 0 ,0 , (LPBYTE) pszName, (LPDWORD) &amp;dwcb); Befehl steht 10 Stellen vor Code Ende.</p>
<p>?!?</p>
<p>Gruß</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/194673/hilfe-bei-ms-code-beispiel-für-joystick-oem-name</link><generator>RSS for Node</generator><lastBuildDate>Tue, 30 Jun 2026 06:39:52 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/194673.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 09 Oct 2007 17:19:42 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to HILFE bei MS-CODE-beispiel für Joystick OEM-Name on Tue, 09 Oct 2007 17:19:42 GMT]]></title><description><![CDATA[<p>Hiho</p>
<p>in der MSDN Lib hab ich folgende Routine für die Abfrage des Joysticknamens gefunden. Wenn ich diese allerdings benütze dann stoße ich auf folgende Fehlermeldung: EAccessValiation &quot;Zugriffsverletzung bei Addresse xyz in der ntdll.dll&quot;...</p>
<p>der Code schaut folgender Maßen aus:</p>
<pre><code>#include &quot;windows.h&quot;
#include &quot;mmsystem.h&quot;

MMRESULT joyGetOEMProductName(UINT id, TCHAR * pszName)
{
 JOYCAPS JoyCaps;
 TCHAR szKey[256];
 TCHAR szValue[256];
 UCHAR szOEMKey[256];
 HKEY hKey;
 DWORD dwcb;
 LONG lr;
// Note: JOYSTICKID1-16 is zero-based; registry entries for VJOYD are 1-based.
 id++;  
 if (id &gt; joyGetNumDevs() ) return JOYERR_NOCANDO;
// Open .. MediaResources\CurentJoystickSettings.
 joyGetDevCaps((id-1), &amp;JoyCaps, sizeof(JoyCaps));
 sprintf(szKey,
   &quot;%s\\%s\\%s&quot;,
   REGSTR_PATH_JOYCONFIG,
   JoyCaps.szRegKey,
   REGSTR_KEY_JOYCURR);
 lr = RegOpenKeyEx(HKEY_LOCAL_MACHINE, (LPTSTR) &amp;szKey, 0, KEY_ALL_ACCESS, &amp;hKey);
 if (lr != ERROR_SUCCESS) return JOYERR_NOCANDO;
// Get OEM Key name.
 dwcb = sizeof(szOEMKey);
  sprintf(szValue, &quot;Joystick%d%s&quot;, id, REGSTR_VAL_JOYOEMNAME);
 lr = RegQueryValueEx(hKey, szValue, 0, 0, (LPBYTE) &amp;szOEMKey, (LPDWORD) &amp;dwcb);
 RegCloseKey(hKey);
 if (lr != ERROR_SUCCESS)
 {
  *pszName = 0;
  return JOYERR_NOCANDO;
 }
// Open OEM Key from ...MediaProperties.
 sprintf(szKey, &quot;%s\\%s&quot;, REGSTR_PATH_JOYOEM, szOEMKey);
 lr = RegOpenKeyEx(HKEY_LOCAL_MACHINE, szKey, 0, KEY_ALL_ACCESS, &amp;hKey);
 if (lr != ERROR_SUCCESS) return JOYERR_NOCANDO;
// Get OEM Name.
 dwcb = sizeof(szValue);
 lr = RegQueryValueEx( hKey,
        REGSTR_VAL_JOYOEMNAME,
        0, 0,
        (LPBYTE) pszName,
        (LPDWORD) &amp;dwcb);
 RegCloseKey(hKey);
 if (lr != ERROR_SUCCESS)
  return JOYERR_NOCANDO;
 else
  return JOYERR_NOERROR;
}
</code></pre>
<p>Der Pointer steht dabei auf lr = RegQueryValueEx( hKey, REGSTR_VAL_JOYOEMNAME, 0 ,0 , (LPBYTE) pszName, (LPDWORD) &amp;dwcb); Befehl steht 10 Stellen vor Code Ende.</p>
<p>?!?</p>
<p>Gruß</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1381503</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1381503</guid><dc:creator><![CDATA[Magge2k]]></dc:creator><pubDate>Tue, 09 Oct 2007 17:19:42 GMT</pubDate></item><item><title><![CDATA[Reply to HILFE bei MS-CODE-beispiel für Joystick OEM-Name on Tue, 09 Oct 2007 18:08:24 GMT]]></title><description><![CDATA[<p>wenn der code von ms ist, denke ich dass er ok ist. wwie rufst du das auf und bitte mehr als nur die eine zeile jetzt posten</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1381523</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1381523</guid><dc:creator><![CDATA[Guck dir den Dieter an]]></dc:creator><pubDate>Tue, 09 Oct 2007 18:08:24 GMT</pubDate></item><item><title><![CDATA[Reply to HILFE bei MS-CODE-beispiel für Joystick OEM-Name on Tue, 09 Oct 2007 18:21:37 GMT]]></title><description><![CDATA[<p>Dieser Thread wurde von Moderator/in <a href="http://www.c-plusplus.net/forum/profile-var-mode-is-viewprofile-and-u-is-1819.html" rel="nofollow">rüdiger</a> aus dem Forum <a href="http://www.c-plusplus.net/forum/viewforum-var-f-is-8.html" rel="nofollow">Rund um die Programmierung</a> in das Forum <a href="http://www.c-plusplus.net/forum/viewforum-var-f-is-4.html" rel="nofollow">WinAPI</a> verschoben.</p>
<p>Im Zweifelsfall bitte auch folgende Hinweise beachten:<br />
<a href="http://www.c-plusplus.net/forum/viewtopic-var-t-is-39405.html" rel="nofollow">C/C++ Forum :: FAQ - Sonstiges :: Wohin mit meiner Frage?</a></p>
<p><em>Dieses Posting wurde automatisch erzeugt.</em></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1381531</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1381531</guid><dc:creator><![CDATA[C++ Forumbot]]></dc:creator><pubDate>Tue, 09 Oct 2007 18:21:37 GMT</pubDate></item><item><title><![CDATA[Reply to HILFE bei MS-CODE-beispiel für Joystick OEM-Name on Tue, 09 Oct 2007 18:23:37 GMT]]></title><description><![CDATA[<p>Ich denke es liegt daran, dass der Parameter pszName nicht ordentlich ist, z.B. NULL oder zu klein.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1381533</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1381533</guid><dc:creator><![CDATA[Badestrand]]></dc:creator><pubDate>Tue, 09 Oct 2007 18:23:37 GMT</pubDate></item><item><title><![CDATA[Reply to HILFE bei MS-CODE-beispiel für Joystick OEM-Name on Tue, 09 Oct 2007 18:30:00 GMT]]></title><description><![CDATA[<p>Evtl. geht der sprintf vorher schief. Dir ist klar, dass Du hier den Speciher von 256 Zeichen evtl. überschreitest.</p>
<p>BTW: Dein Code wird unter Vista nicht funktionieren.<br />
Unter HKLM kannst Du nur als Prozess mit Admin Rechten einen Pfad mit KEY_ALL_ACCESS öffnen. Unter W2K+XP wird Dein Code nur als Admin laufen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1381542</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1381542</guid><dc:creator><![CDATA[Martin Richter]]></dc:creator><pubDate>Tue, 09 Oct 2007 18:30:00 GMT</pubDate></item><item><title><![CDATA[Reply to HILFE bei MS-CODE-beispiel für Joystick OEM-Name on Wed, 10 Oct 2007 00:21:57 GMT]]></title><description><![CDATA[<p>Martin Richter schrieb:</p>
<blockquote>
<p>BTW: Dein Code wird unter Vista nicht funktionieren.<br />
Unter HKLM kannst Du nur als Prozess mit Admin Rechten einen Pfad mit KEY_ALL_ACCESS öffnen. Unter W2K+XP wird Dein Code nur als Admin laufen.</p>
</blockquote>
<p>Darf ich fragen was es für sinnige Alternativen gäbe?</p>
<p>EDIT: Mir ist eben der Link zum o.g. script in die Hände gefallen:<br />
<a href="http://msdn.microsoft.com/archive/default.asp?url=/archive/en-us/dnargame/html/msdn_sidewind3d.asp" rel="nofollow">http://msdn.microsoft.com/archive/default.asp?url=/archive/en-us/dnargame/html/msdn_sidewind3d.asp</a></p>
<p>Viele Grüße<br />
vizArt</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1381663</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1381663</guid><dc:creator><![CDATA[vizArt]]></dc:creator><pubDate>Wed, 10 Oct 2007 00:21:57 GMT</pubDate></item><item><title><![CDATA[Reply to HILFE bei MS-CODE-beispiel für Joystick OEM-Name on Wed, 10 Oct 2007 13:13:03 GMT]]></title><description><![CDATA[<p>Hiho,</p>
<p>ich habe festgestellt das in der besagten Zeile das &amp; bei (LPBYTE) &amp;pszName, gefehlt hat.</p>
<p>Nun kann ich den Code ausführen doch bekomm ich keinen Wert zurückgeliefert wenn ich wie Folgt abfrage.</p>
<p>char *test;</p>
<p>joyGetOEMProductName(1, test);<br />
Label2-&gt;Caption = test;</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1382076</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1382076</guid><dc:creator><![CDATA[Magge2k]]></dc:creator><pubDate>Wed, 10 Oct 2007 13:13:03 GMT</pubDate></item><item><title><![CDATA[Reply to HILFE bei MS-CODE-beispiel für Joystick OEM-Name on Wed, 10 Oct 2007 13:20:34 GMT]]></title><description><![CDATA[<pre><code>MMRESULT joyGetOEMProductName(UINT id, TCHAR *pszName)
{
 JOYCAPS JoyCaps;
 TCHAR szKey[256];
 TCHAR szValue[256];
 UCHAR szOEMKey[256];
 UCHAR pszOEMKey[256];
 HKEY hKey;
 DWORD dwcb;
 LONG lr;
// Note: JOYSTICKID1-16 is zero-based; registry entries for VJOYD are 1-based.
 id++;
 if (id &gt; joyGetNumDevs() ) return JOYERR_NOCANDO;
// Open .. MediaResources\CurentJoystickSettings.
 joyGetDevCaps((id-1), &amp;JoyCaps, sizeof(JoyCaps));
 sprintf(szKey,
   &quot;%s\\%s\\%s&quot;,
   REGSTR_PATH_JOYCONFIG,
   JoyCaps.szRegKey,
   REGSTR_KEY_JOYCURR);
 lr = RegOpenKeyEx(HKEY_LOCAL_MACHINE, (LPTSTR) &amp;szKey, 0, KEY_ALL_ACCESS, &amp;hKey);
 if (lr != ERROR_SUCCESS) return JOYERR_NOCANDO;
// Get OEM Key name.
 dwcb = sizeof(szOEMKey);
 sprintf(szValue, &quot;Joystick%d%s&quot;, id, REGSTR_VAL_JOYOEMNAME);

 lr = RegQueryValueEx(hKey, szValue, 0, 0, (LPBYTE) &amp;szOEMKey, (LPDWORD) &amp;dwcb);
 RegCloseKey(hKey);
 if (lr != ERROR_SUCCESS)
 {
  *pszName = 0;
  return JOYERR_NOCANDO;
 }
// Open OEM Key from ...MediaProperties.
 sprintf(szKey, &quot;%s\\%s&quot;, REGSTR_PATH_JOYOEM, szOEMKey);
 lr = RegOpenKeyEx(HKEY_LOCAL_MACHINE, szKey, 0, KEY_ALL_ACCESS, &amp;hKey);
 if (lr != ERROR_SUCCESS) return JOYERR_NOCANDO;
// Get OEM Name.
 dwcb = sizeof(szValue);
 lr = RegQueryValueEx( hKey,
        REGSTR_VAL_JOYOEMNAME,
        0,
        0,
        (LPBYTE) &amp;pszOEMKey,
        (LPDWORD) &amp;dwcb);
 RegCloseKey(hKey);
 sprintf(pszName, &quot;%s&quot;, pszOEMKey);
 if (lr != ERROR_SUCCESS)
  return JOYERR_NOCANDO;
 else
  return JOYERR_NOERROR;
}
</code></pre>
<p>so ich habs jetzt selbst folls geschafft... man sollte meinen wenn man sich solche Code Beispiele holt, dass diese dann auch funktionieren...aber anscheinend ist das wohl nicht so der fall... naja... auf jeden fall klappts nun.</p>
<p>Danke @ all</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1382090</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1382090</guid><dc:creator><![CDATA[Magge2k]]></dc:creator><pubDate>Wed, 10 Oct 2007 13:20:34 GMT</pubDate></item><item><title><![CDATA[Reply to HILFE bei MS-CODE-beispiel für Joystick OEM-Name on Wed, 10 Oct 2007 14:03:43 GMT]]></title><description><![CDATA[<p>Da Du nicht Schreiben willst genügt doch ein KEY_ACCESS_READ!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1382132</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1382132</guid><dc:creator><![CDATA[Martin Richter]]></dc:creator><pubDate>Wed, 10 Oct 2007 14:03:43 GMT</pubDate></item><item><title><![CDATA[Reply to HILFE bei MS-CODE-beispiel für Joystick OEM-Name on Wed, 10 Oct 2007 14:36:09 GMT]]></title><description><![CDATA[<p>Martin Richter schrieb:</p>
<blockquote>
<p>Da Du nicht Schreiben willst genügt doch ein KEY_ACCESS_READ!</p>
</blockquote>
<p>Danke für Deine Antwort <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";-)"
      alt="😉"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1382162</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1382162</guid><dc:creator><![CDATA[vizArt]]></dc:creator><pubDate>Wed, 10 Oct 2007 14:36:09 GMT</pubDate></item><item><title><![CDATA[Reply to HILFE bei MS-CODE-beispiel für Joystick OEM-Name on Wed, 10 Oct 2007 15:04:43 GMT]]></title><description><![CDATA[<p>@Magge2k: also irgendwie seltsam. Dein Code weicht im letzten Bereich vom Original MS-Code ab. Vergleich mal Dein Code mit dem: <a href="http://msdn.microsoft.com/archive/en-us/dnargame/html/msdn_sidewind3d.asp" rel="nofollow">http://msdn.microsoft.com/archive/en-us/dnargame/html/msdn_sidewind3d.asp</a> . Dieser hat nach dem Ersetzten von: KEY_ACCESS_READ in KEY_READ einwandfrei funktioniert.</p>
<p>Viele Grüße<br />
vizArt</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1382182</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1382182</guid><dc:creator><![CDATA[vizArt]]></dc:creator><pubDate>Wed, 10 Oct 2007 15:04:43 GMT</pubDate></item></channel></rss>