Menu ▾ ▴

#80 nicer registry commands log

closed-accepted
None
5
2014-08-23
2005-10-28
Instructor
No

install.log (without patch):

WriteRegStr: set -2147483647\SOFTWARE\Opera
Software\a\X to y
WriteRegStr: set -2147483647\SOFTWARE\Opera
Software\a\\X\/\ to y
WriteRegDWORD: set -2147483647\SOFTWARE\Opera
Software\a\X2 to 12345
WriteRegBin: set -2147483647\SOFTWARE\Opera
Software\a\X3 with 3 bytes
DeleteRegValue: -2147483647\SOFTWARE\Opera
Software\a\X2
DeleteRegKey: -2147483647\Software\Opera Software\a
RMDir: RemoveDirectory invalid input("")

install.log (with patch):

WriteRegStr:
"HKEY_CURRENT_USER\SOFTWARE\Opera
Software\a" "X"="y"
WriteRegExpandStr:
"HKEY_CURRENT_USER\SOFTWARE\Opera
Software\a" "\X\/\"="y"
WriteRegDWORD:
"HKEY_CURRENT_USER\SOFTWARE\Opera
Software\a" "X2"="12345"
WriteRegBin:
"HKEY_CURRENT_USER\SOFTWARE\Opera
Software\a" "X3"="01ffdd"
DeleteRegValue:
"HKEY_CURRENT_USER\SOFTWARE\Opera
Software\a" "X2"
DeleteRegKey:
"HKEY_CURRENT_USER\Software\Opera Software\a"
RMDir: RemoveDirectory invalid input("")

Discussion

  • Amir Szekely

    Amir Szekely - 2005-10-28

    Logged In: YES
    user_id=584402

    You forgot to attach the patch. Make sure you check the box,
    it's always forgotten.

     
  • Amir Szekely

    Amir Szekely - 2005-10-28
    • assigned_to: nobody --> kichik
     
  • Instructor

    Instructor - 2005-10-28

    Ou, ofcourse checkbox..

     
  • Amir Szekely

    Amir Szekely - 2005-10-28

    Logged In: YES
    user_id=584402

    Thanks.

    Your patch has effects, even when not compiled with
    NSIS_CONFIG_LOG.

    1) In EW_WRITEREG, you can use an if block on rtype when
    type is REG_SZ instead of checking if type is REG_SZ_EXPAND.
    2) Why remove `// use buf2, buf3 and buf4`? It's still true.
    3) Only WriteRegBin uses buf4, don't define it. Use bufs[4].

    And also, there're some other problems:

    4) GetCompressedDataFromDataBlockToMemory changes buf3 when
    using WriteRegBin. It also uses buf4, which is ran over by
    my_HexDataToHexStr.
    5) Please rename the new functions to _FuncName and the
    define to the real function name. The my_ prefix is usually
    used in the code for API wrappers.
    6) buf4 is not large enough to contain the hex
    representation of 3072 bytes, let alone 1024 bytes. I'm also
    not so sure the entire block should be written to the log.
    The first few bytes should be enough.
    4) Advancing the pointer in HexDataToHexStr would be more
    efficient than using lstrcat.

     
  • Instructor

    Instructor - 2005-10-30

    Logged In: YES
    user_id=1197108

    4) I have some problem with what functions what buffers
    changes, because I don't see any problem with correct log
    output.
    6) I have thought that user can't input more then
    NSIS_MAX_STRLEN characters (AABBCC...). Now if number
    of bytes will be more then 8 it will be trimmed like
    "AABBCCDDAABBCCDD..."
    7) As it only 8 bytes to save to log probably lstrcat will be ok

     
  • Instructor

    Instructor - 2005-10-30
     
  • Amir Szekely

    Amir Szekely - 2005-11-01

    Logged In: YES
    user_id=584402

    4) Have you used a long enough binary string? You need at
    least 2048 bytes of data for buf4 to be used.
    6) Since version 2.01, WriteRegBin accepts 3 *
    NSIS_MAX_STRLEN. You can see it in the function call where 3
    * NSIS_MAX_STRLEN is passed.
    7) Indeed.

     
  • Instructor

    Instructor - 2005-11-04

    Logged In: YES
    user_id=1197108

    Simply used another buffer bufs[5] instead buf3.

     
  • Instructor

    Instructor - 2005-11-04
     
  • Amir Szekely

    Amir Szekely - 2005-11-05

    Logged In: YES
    user_id=584402

    There's no such thing as bufs[5], and it still uses bufs[4]
    which can be overridden. Maybe you can call the
    uncompression function twice. Once with just a little data
    for the log, and then again for the entire data block. Make
    sure it works with all compression types.

     
  • Instructor

    Instructor - 2005-11-05

    Logged In: YES
    user_id=1197108

    Can you explain what do the line:
    size = GetCompressedDataFromDataBlockToMemory(parm3,
    data, 3 * NSIS_MAX_STRLEN);

    and what buffers it changes

     
  • Amir Szekely

    Amir Szekely - 2005-11-05

    Logged In: YES
    user_id=584402

    It uncompresses data pointed by parm3 into data with a
    maximum of 3 * NSIS_MAX_STRLEN bytes uncompressed. All you
    really need to know about it, is what the comment above it
    says - it affects buf2, buf3 and buf4.

     
  • Instructor

    Instructor - 2005-11-06
     
  • Instructor

    Instructor - 2005-11-06

    Logged In: YES
    user_id=1197108

    Another try, using rootstr[24]

     
  • Instructor

    Instructor - 2005-11-10

    Logged In: YES
    user_id=1197108

    Any comments? I hope buf3 not used after
    GetCompressedDataFromDataBlockToMemory

     
  • Amir Szekely

    Amir Szekely - 2005-11-11

    Logged In: YES
    user_id=584402

    The same still goes for bufs[3]. You can't use it after
    GetCompressedDataFromDataBlockToMemory.

    You also haven't address issue #1 in my original comment.
    With your patch, the code size will grow even without
    NSIS_CONFIG_LOG.

     
  • Instructor

    Instructor - 2005-11-12

    Logged In: YES
    user_id=1197108

    Hope the last variant (double calling
    GetCompressedDataFromDataBlockToMemory and
    RegKeyHandleToName)

     
  • Instructor

    Instructor - 2005-11-12
     
  • Amir Szekely

    Amir Szekely - 2005-11-12

    Logged In: YES
    user_id=584402

    That should work. Have you tested it using all compression
    types?

    Why put the hex data in buf3 and the root key name in buf2
    again? Why not simply putting the hex data in buf2?

    You still haven't address issue number 1 in my original
    comment. Your code still affects the installer, even without
    NSIS_CONFIG_LOG.

     
  • Instructor

    Instructor - 2005-11-13

    Logged In: YES
    user_id=1197108

    >Have you tested it using all compression
    types?
    Yes

    >Why put the hex data in buf3 and the root key name in buf2
    >again? Why not simply putting the hex data in buf2?
    1. "LPBYTE data = (LPBYTE) buf2;" so it will be the same
    buffer "LogHexData(parm3, data, buf2, 8);"
    2. As function "LogHexData" use
    "GetCompressedDataFromDataBlockToMemory", it can
    change buf3, therefore function "RegKeyHandleToName" uses
    twice.

    >You still haven't address issue number 1 in my original
    >comment.
    Sorry that I ignore the previous the same comment, I simply
    don't understand what do you mean.

     
  • Amir Szekely

    Amir Szekely - 2005-11-24
    • summary: Patch for registry log --> nicer registry commands log
    • status: open --> closed-accepted
     
  • Amir Szekely

    Amir Szekely - 2005-11-24

    Logged In: YES
    user_id=584402

    I've modified and applied the patch. The modified patch is
    attached. Thanks for the patch.

    If you want, drop by the irc channel and I'll try to better
    explain what I wanted in issue #1.

     
  • Amir Szekely

    Amir Szekely - 2005-11-24

    the applied patch

     

Log in to post a comment.