We are working on converting the wiki to a static website controlled by markdown files in https://github.com/nsis-community. You can already see there how plug-ins will be posted. The end-user interface will still be a website but with a fresh coat of paint. Come meet us at Discord to talk about it.
Copying files to pda
From NSIS Wiki
Jump to navigationJump to search
Description
This script shows you how to "copy" a file from a desktop machine to a PDA using RAPI. This can be used to copy files other than .cab files. There are better ways to install cab files on a PDA, using CeAppMgr. To use this function you require the rapi.dll, which is installed along with ActiveSync.
The Function
Function createSettingsFile ;Init RAPI ;---------------------- ;Dll Call Structure ; ;HRESULT CeRapiInit(void); System::Call "rapi::CeRapiInit() i .r0" ;Create the file on the PDA ;---------------------- ;Dll Call Structure ; ;HANDLE CeCreateFile( ; LPCWSTR lpFileName, ; DWORD dwDesiredAccess, ; DWORD dwShareMode, ; LPSECURITY_ATTRIBUTES lpSecurityAttributes, ; DWORD dwCreationDisposition, ; DWORD dwFlagsAndAttributes, ; HANDLE hTemplateFile ;); ; ; Access Mode Values : ; GENERIC_READ = 0x80000000; ; GENERIC_WRITE = 0x40000000; ; ; Creation Disposition Value : ; CREATE_NEW = 1; ; CREATE_ALWAYS = 2; ; OPEN_EXISTING = 3; ; ; Flag and attribute values ; FILE_ATTRIBUTE_NORMAL = 0x80; ; FILE_ATTRIBUTE_DIRECTORY = 0x10; ; FILE_ATTRIBUTE_TEMPORARY = 0x100; System::Call "rapi::CeCreateFile(w '\filename.txt', i 0x80000000|0x40000000, i 0, i 0, i 2, i 0x80, i 0) i .r10" ;Write your data across. Can be done in a loop etc. FileOpen $0 'FileName' r IfErrors done loop: FileRead $0 $1 IfErrors done ;Get the length of the string read StrLen $2 $1 ;---------------------- ;Dll Call Structure ; ;BOOL CeWriteFile( ; HANDLE hFile, ; LPCVOID lpBuffer, ; DWORD nNumberOfBytesToWrite, ; LPDWORD lpNumberOfBytesWritten, ; LPOVERLAPPED lpOverlapped ;); System::Call "rapi::CeWriteFile(i r10., t r1, i r2, *i r3, i 0) i .r11" Goto loop ;---------------------- ;Dll Call Structure ; ;BOOL CeCloseHandle( ; HANDLE hObject ;); done: ;Close the file on the PDA System::Call "rapi::CeCloseHandle(i r10) i .r1" ;Close the local file FileClose $0 System::Free 0 FunctionEnd
Basically it initialises RAPI, creates the file on the PDA, reads line by line from the local file and writes the file on the PDA!