Announcement

Collapse
No announcement yet.

move dll file from source to destination on reboot

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • move dll file from source to destination on reboot

    i want to move a dll from source to destination on a reboot. i have tried

    SetOverwrite on
    Rename /REBOOTOK "C:\Temp\test.dll" "D:\test\test.dll" ; Didnt work
    System::Call "kernel32::MoveFileEx(t 'C:\Temp\test.dll', t 'D:\test\test.dll', i 5)" ; Didnt work

    Tried InstallLib..nothing seems to work

  • #2
    PHP Code:
    System::Call "kernel32::MoveFileEx(t 'C:\Temp\test.dll', t 'D:\test\test.dll', i 5)i.r0?e"
    Pop $1
    MessageBox mb_ok 
    $0,$
    What does the messagebox say?

    Remember that you must run as elevated administrator for reboot renaming to work...
    IntOp $PostCount $PostCount + 1

    Comment


    • #3
      it shows 1,127

      Comment


      • #4
        1 means success.

        It is very annoying when you ask the same question on Stackoverflow but provide slightly different information there. Which file are you actually trying to replace?
        IntOp $PostCount $PostCount + 1

        Comment


        • #5
          i am sorry delay reply. i am trying to replace a dll . when i use system call, even though it shows success as per return code, it is actually not moving the file. i did compare it using fc cmd. the same applies when i use rename nsis fn. prior to restart , it sets pending rename operation key in registry and post restart file key is deleted. but again file is not moved

          Comment


          • #6
            Again, which file are you actually trying to replace? Give us the real name...
            IntOp $PostCount $PostCount + 1

            Comment


            • #7
              the dll does make note of event handling. events.dll

              Comment


              • #8
                Please try Process Monitor boot logging feature
                IntOp $PostCount $PostCount + 1

                Comment


                • #9
                  this will be one of the most annoying issue i have ever seen. boot log says it is completed successfully. however if i compare files using fc between my source and destination, it says bth are different files. this is for rename fn.
                  for system call, result pending file name operations not found error... not sure why this is seen

                  Comment


                  • #10
                    Rename /rebootok ends up as MoveFileEx(pszExisting, pszNew, MOVEFILE_DELAY_UNTIL_REBOOT|MOVEFILE_REPLACE_EXISTING); so I don't understand how the behavior would be different from the System::Call.

                    Which Windows version does it fail on? 64-bit?
                    IntOp $PostCount $PostCount + 1

                    Comment


                    • #11
                      windows 64 bit

                      Comment


                      • #12
                        my code is as simple as this

                        SetOverwrite on
                        SetOutPath "$TEMP"
                        ${Logit} "Copying events dll to $TEMP folder"
                        File "/oname=$TEMP\events.tmp" "..\..\bld\nsis\events.dll"
                        /* OPTIONAL
                        SetFileAttributes "events_hooks_lib.dll" FILE_ATTRIBUTE_NORMAL
                        ClearErrors */
                        Rename /REBOOTOK "$TEMP\events.tmp" "$PRODDIR\events.dll"

                        Comment


                        • #13
                          Is $PRODDIR inside Program files (x86)? What if you set it to c:\test?

                          What if you extract events.tmp to $PRODDIR before the rename?

                          SetFileAttributes call is missing full path...
                          IntOp $PostCount $PostCount + 1

                          Comment


                          • #14
                            $PRODDIR is a separate partition where OS is not installed. even if I set SetFileAttributes full path is does not make any difference.
                            I can extract before rename and it works. currently, that is the approach. but sometimes the file gets locked and my installation fails. to overcome this I want to install files post-reboot

                            Comment


                            • #15
                              My only suggestion is to avoid cross-volume operations, do:

                              File "/oname=$proddir\events.tmp" "..\..\bld\nsis\events.dll"
                              SetFileAttributes "$proddir\events.dll" FILE_ATTRIBUTE_NORMAL
                              Rename /REBOOTOK "$proddir\events.tmp" "$PRODDIR\events.dll"
                              IntOp $PostCount $PostCount + 1

                              Comment

                              Working...
                              X
                              😀
                              🥰
                              🤢
                              😎
                              😡
                              👍
                              👎