<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic of course these are preceded in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Can-t-write-to-registry/m-p/1106060#M127975</link>
    <description>&lt;P&gt;of course these are preceded by:&lt;/P&gt;

&lt;PRE class="brush:fortran;"&gt;    buff = "                             "C
    iLen = sizeof(buff) - 1
    iret = RegOpenKeyEx (HKEY_CURRENT_USER,     &amp;amp;
                         "PDC"C,                &amp;amp;
                         0,                     &amp;amp;
                         KEY_ALL_ACCESS,        &amp;amp;
                         LOC(hKey) )

    if (iret == ERROR_SUCCESS) Then
&lt;/PRE&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 26 Apr 2016 19:58:56 GMT</pubDate>
    <dc:creator>Brooks_Van_Horn</dc:creator>
    <dc:date>2016-04-26T19:58:56Z</dc:date>
    <item>
      <title>Can't write to registry</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Can-t-write-to-registry/m-p/1106053#M127968</link>
      <description>&lt;P&gt;My setup program created three keys in the Win 10 registry and I can read them but when I try to change the value of one of them I get an error 5 (lack of access priviledge). My code looks something like:&lt;/P&gt;

&lt;PRE class="brush:fortran;"&gt;Subroutine ChkReg()

use ifwinty
use user32
use advapi32

implicit none

Integer(4):: iret, iLen
Integer(4):: lret
Integer(4):: hKey = 0
character(255):: buff

    buff = "                             "C
    iLen = sizeof(buff) - 1
    iret = RegOpenKeyEx (HKEY_CLASSES_ROOT,     &amp;amp;
                         "PDC"C,                                                       &amp;amp;
                         0,                                                                    &amp;amp;
                         KEY_EXECUTE,                                           &amp;amp;  ! only key that works
                         LOC(hKey) )

    if (iret == ERROR_SUCCESS) Then
       buff = "                             "C
       lret = RegQueryValueEx( hKey, "Data1"C, NULL, NULL, &amp;amp;
                               LOC(buff), iLen )
       if (iret /= ERROR_SUCCESS) Then
          buff = "                             "C
          lret = RegQueryValueEx( hKey, "Data1"C, NULL, NULL, &amp;amp;
                               LOC(buff), iLen )
          iret = MessageBox(NULL, buff, "Data1 Register PDC2", IDOK)
       else
          iret = MessageBox(NULL, buff, "Data1 Register PDC1", IDOK)
       end if

       Buff = "123456789"C
       iLen = 10
       iret = RegSetValueEX ( hKey, "Data1"C, 0, REG_SZ, LOC(Buff), iLen)

       iret = RegCloseKey(hKey)

    End If

End Subroutine ChkReg&lt;/PRE&gt;

&lt;P&gt;All works well except the RegSetValueEX which returns an error code of 5. If I try a key of KEY_ALL_ACCESS then I get an error code 5 in RegOpenKeyEx. Any suggestions will be much appreciated.&lt;/P&gt;

&lt;P&gt;Thanks,&lt;/P&gt;

&lt;P&gt;Brooks&lt;/P&gt;</description>
      <pubDate>Tue, 26 Apr 2016 06:49:42 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Can-t-write-to-registry/m-p/1106053#M127968</guid>
      <dc:creator>Brooks_Van_Horn</dc:creator>
      <dc:date>2016-04-26T06:49:42Z</dc:date>
    </item>
    <item>
      <title>If I change where my setup</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Can-t-write-to-registry/m-p/1106054#M127969</link>
      <description>&lt;P&gt;If I change where my setup program puts the entries to HKEY_CURRENT_USER then I can read and write but isn't this hkcu key cleared when I logoff?&lt;/P&gt;</description>
      <pubDate>Tue, 26 Apr 2016 07:17:39 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Can-t-write-to-registry/m-p/1106054#M127969</guid>
      <dc:creator>Brooks_Van_Horn</dc:creator>
      <dc:date>2016-04-26T07:17:39Z</dc:date>
    </item>
    <item>
      <title>If you want to set a value,</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Can-t-write-to-registry/m-p/1106055#M127970</link>
      <description>&lt;P&gt;If you want to set a value, then the handle to the key needs to have been opened with KEY_WRITE access (and perhaps others).&lt;/P&gt;

&lt;P&gt;Try replacing `KEY_EXECUTE` on line 19 with `IOR(KEY_READ, KEY_WRITE)`.&lt;/P&gt;

&lt;P&gt;KEY_ALL_ACCESS probably requests "too much" access, beyond the level permitted for a user that is not a "real" administrator.&lt;/P&gt;

&lt;P&gt;(I would expect MessageBox to require null terminated strings.)&lt;/P&gt;</description>
      <pubDate>Tue, 26 Apr 2016 07:25:57 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Can-t-write-to-registry/m-p/1106055#M127970</guid>
      <dc:creator>IanH</dc:creator>
      <dc:date>2016-04-26T07:25:57Z</dc:date>
    </item>
    <item>
      <title>I changed Messagebox to ""C</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Can-t-write-to-registry/m-p/1106056#M127971</link>
      <description>&lt;P&gt;I changed Messagebox to ""C strings. But I have another problem. I am reading Ok but I sometimes get junk after the data that I want. How do I stop that?&lt;/P&gt;

&lt;P&gt;Brooks&lt;/P&gt;</description>
      <pubDate>Tue, 26 Apr 2016 16:04:37 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Can-t-write-to-registry/m-p/1106056#M127971</guid>
      <dc:creator>Brooks_Van_Horn</dc:creator>
      <dc:date>2016-04-26T16:04:37Z</dc:date>
    </item>
    <item>
      <title>ilen will return the number</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Can-t-write-to-registry/m-p/1106057#M127972</link>
      <description>&lt;P&gt;ilen will return the number of good bytes in buff if the return status is OK&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Apr 2016 18:06:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Can-t-write-to-registry/m-p/1106057#M127972</guid>
      <dc:creator>andrew_4619</dc:creator>
      <dc:date>2016-04-26T18:06:00Z</dc:date>
    </item>
    <item>
      <title>Andrew,</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Can-t-write-to-registry/m-p/1106058#M127973</link>
      <description>&lt;P&gt;Andrew,&lt;/P&gt;

&lt;P&gt;Thanks for that. I didn't check the ret code. I have adapted a Hash sort routine from Numerical Recipies and it works really well. I decided to extend the code to sort arrays of strings without shuffling them around by using an integer index array. The sort seems to work except for the last element in the string and it doesn't want to get sorted correctly. Would you mind looking at it and see where my logic fails. I'll zip both the working version and the non-working array of strings one. This has stumpted me for several days.&lt;/P&gt;

&lt;P&gt;Thank you very much.&lt;/P&gt;

&lt;P&gt;Brooks&lt;/P&gt;</description>
      <pubDate>Tue, 26 Apr 2016 19:08:41 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Can-t-write-to-registry/m-p/1106058#M127973</guid>
      <dc:creator>Brooks_Van_Horn</dc:creator>
      <dc:date>2016-04-26T19:08:41Z</dc:date>
    </item>
    <item>
      <title>It still doesn't work.See:</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Can-t-write-to-registry/m-p/1106059#M127974</link>
      <description>&lt;P&gt;It still doesn't work.See:&lt;/P&gt;

&lt;PRE class="brush:fortran;"&gt;       iLen = 20
       Buff = ""C
       iret = RegQueryValueEx( hKey, "Data4"C, NULL, NULL, LOC(Buff), iLen )
       if (iret == ERROR_SUCCESS) Then
           myBuff = Buff(1:iLen-1)
           write(Buff,100) 'iLen = ', iLen, myBuff, iret
100        format (a,i2,5x,a,i5)
           iret = MessageBox(NULL, Buff // "x1"C, "Data4 Query"C, MB_OK)
       else
           iret = RegQueryValueEx( hKey, "Data4"C, NULL, NULL, LOC(MySN2), iLen )
           myBuff = Buff(1:iLen-1)
           write(Buff,100) 'iLen = ', iLen, myBuff, iret
           iret = MessageBox(NULL, Buff // "x2"C, "Data4 Query"C, MB_OK)
       end if
&lt;/PRE&gt;

&lt;P&gt;If I type Buff it appears as 1000 followed by some garbage.&lt;/P&gt;

&lt;P&gt;Brooks&lt;/P&gt;

&lt;P&gt;I repeated the RegQueryValueEx because the CVF Guide to Creating Windows Applications said it was wise.&lt;/P&gt;</description>
      <pubDate>Tue, 26 Apr 2016 19:57:05 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Can-t-write-to-registry/m-p/1106059#M127974</guid>
      <dc:creator>Brooks_Van_Horn</dc:creator>
      <dc:date>2016-04-26T19:57:05Z</dc:date>
    </item>
    <item>
      <title>of course these are preceded</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Can-t-write-to-registry/m-p/1106060#M127975</link>
      <description>&lt;P&gt;of course these are preceded by:&lt;/P&gt;

&lt;PRE class="brush:fortran;"&gt;    buff = "                             "C
    iLen = sizeof(buff) - 1
    iret = RegOpenKeyEx (HKEY_CURRENT_USER,     &amp;amp;
                         "PDC"C,                &amp;amp;
                         0,                     &amp;amp;
                         KEY_ALL_ACCESS,        &amp;amp;
                         LOC(hKey) )

    if (iret == ERROR_SUCCESS) Then
&lt;/PRE&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Apr 2016 19:58:56 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Can-t-write-to-registry/m-p/1106060#M127975</guid>
      <dc:creator>Brooks_Van_Horn</dc:creator>
      <dc:date>2016-04-26T19:58:56Z</dc:date>
    </item>
    <item>
      <title>Andrew,</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Can-t-write-to-registry/m-p/1106061#M127976</link>
      <description>&lt;P&gt;Andrew,&lt;/P&gt;

&lt;P&gt;When I put a LOC() around iLen, everything worked correctly.&amp;nbsp; Thanks all.&lt;/P&gt;

&lt;P&gt;Brooks&lt;/P&gt;</description>
      <pubDate>Tue, 26 Apr 2016 20:53:58 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Can-t-write-to-registry/m-p/1106061#M127976</guid>
      <dc:creator>Brooks_Van_Horn</dc:creator>
      <dc:date>2016-04-26T20:53:58Z</dc:date>
    </item>
  </channel>
</rss>

