Tips: FreeBasic: CopyFolder


#Include once "dir.bi"
#Include once "file.bi"
#Include Once "string.bi"
#include once "ext/strings/strsplit.bi"
#Include Once "win/shlobj.bi"

sub copyfolder(dirName as string, dstdir as string)
    const attrib_mask = fbDirectory  or fbNormal Or fbHidden Or fbSystem or fbReadOnly or fbArchive
    dim as uinteger out_attr
    dim fileName as string
    dim absname as String
    
    fileName = Dir(dirName + "\*", attrib_mask, out_attr)
    print "fileName >>>> " + fileName
    Do Until Len(fileName) = 0 '' loop until Dir returns empty string
        If (fileName <> ".") And (fileName <> "..") Then '' ignore current and parent directory entries
     
            absName = dirName & "\" & fileName
            '
            If out_attr And fbDirectory Then
                dim d as string
                d = right(absName,Len(absName) - InStrRev(absName, "\"))
                Print "d = " + d        
                Print "absName =" + absName                
                dstDir = dstDir + "\" + d 
                Print "DST = " + dstdir
                
                SHCreateDirectoryEx(0,StrPtr(dstDir),0)
                copyfolder(absName, dstDir )
            Else
                dim d as String
                d = right(absName,Len(absName) - InStrRev(absName, "\"))
                SHCreateDirectoryEx(0,StrPtr(dstDir),0)
                FileCopy(absName, dstdir + "\" + d)
                Print "file: " + absName + " DST: " + dstDir
            End If
        End If
      fileName = Dir(out_attr)
    Loop
end sub

Code: Freebasic: runas


#Include "windows.bi"
#inclib "advapi32"

Declare FUNCTION CreateProcessWithLogonW LIB "ADVAPI32" ALIAS "CreateProcessWithLogonW" ( _
        byval lpUsername As LPCWSTR  , _
        BYVAL lpDomain AS LPCWSTR , _
        BYVAL lpPassword AS LPCWSTR, _
        BYVAL dwLogonFlags AS DWORD, _
        BYVAL lpApplicationName AS LPCWSTR , _
        BYVAL lpCommandLine AS LPCWSTR , _
        BYVAL dwCreationFlags AS DWORD, _
        BYVAL lpEnvironment AS DWORD, _
        BYVAL lpCurrentDirectory AS LPCWSTR , _
        lpStartupInfo AS STARTUPINFO, _
        lpProcessInfo AS PROCESS_INFORMATION) AS LONG

Const X_CJ_LOGON_WITH_PROFILE=1
Const X_CJ_CREATE_DEFAULT_ERROR_MODE = &H04000000

FUNCTION RunAsUser(BYVAL UserName AS STRING, _                   
        BYVAL Password AS STRING, _
        BYVAL DomainName AS STRING, _
        BYVAL CommandLine AS STRING, _
        BYVAL CurrentDirectory AS STRING) AS boolean

        Dim si AS STARTUPINFO
        Dim pi AS PROCESS_INFORMATION
        Dim AS String wCurrentDir,wCommandLine,wPassword,wUser,wDomain
        Dim R01 AS LONG

        si.cb = LEN(si)
        wUser = UserName
        wDomain = DomainName
        wPassword = Password
        wCommandLine = CommandLine
        wCurrentDir = CurrentDirectory
        Print wCommandLine & "TEST"
        R01 = CreateProcessWithLogonW(wUser,wDomain,wPassword, _
                        X_CJ_LOGON_WITH_PROFILE, 0&, wCommandLine, _
                        X_CJ_CREATE_DEFAULT_ERROR_MODE, 0&, wCurrentDir, si, pi)
        IF R01  0 THEN
                CloseHandle pi.hThread
                CloseHandle pi.hProcess
                Return TRUE
        ELSE
                Return FALSE
        END If
End FUNCTION

Dim As Long R01
Dim As String  user_name,password,domain,program,workingDir

user_name="username"
password="pa$$word"
domain="domain"
program="C:\\windows\\notepad.exe"
workingDir="C:\\windows"

R01=RunAsUser(user_name,password,domain,program,workingDir)

Compile juce dll using code::block and mingw.


  1. Import solution from “Build\VisualStudio2008_DLL”
  2. add liboleaut32; libshell32.a; libole32.a; libvfw32.a; libwinmm.a; libwininet.a;libws2_32.a; libdsound.a; libwsock32.a; libwldap32.a; libkernel32; libopengl32.a; libglu32.a; libuuid.a; librpcrt4.a; libgdi32.a; libcomdlg32.a; libversion.a; libdsound.a; libshlwapi.a  in library.
  3. add  “#ifndef _WIN32_WINNT
    #define _WIN32_WINNT 0x0501
    #endif” when you get “error: ‘getaddrinfo’ was not declared in this scope”  error while compiling.
  4. Set -mach=i586 in compilation option.
libwininet.a
libdsound.a
libole32.a
libwinmm.a
libgdi32.a
libuuid.a
libshell32.a
libvfw32.a
librpcrt4.a

Bug: Zune: File fails to sync with Zune


When I first got zune for myself, I was very happy that for only $90 I am getting 30GB Zune, but in few days only i found that it is not for persons like me, who like freedom and simplicity.

Anyway one of the biggest problem I found was that Zune can not be sync’ed on Linux because Microsoft forgot that there might be people (like me) who might not have Windows as Operating System.

RPM Interview Questions


Q: How to install packages with all the dependency packages if all the packages are available at a common repository?
Ans : rpm –ivh  –aid packagename.

Q: How to check, where a particular package installed it’s configuration files.
Ans : rpm –qc packagename.

Q: How to check the change log of the installed package.
Ans : rpm -q –changelog packagename.

Q: How to check, where a particular package installed it’s doc files.
Ans : rpm -qd packagenme

Q: How to check all the files installed by package?
Ans : rpm -q –filesbypkg packagename

Q: How to check the version of files installed by a package
Ans : rpm -qi packagename

Q: How to check the dependencies for a particular packages i.e. Required libraries packages etc.
Ans : rpm -q -R packagename.

Q: How to upgrade the packages which are already installed on to the linux box.
Ans : rpm -F install options packagename.

Q: What is the command to update only the rpm database.
Ans : rpm -i –justdb packagename

Q: What is the command to check whether a particular package installation would be successful but would not actually install the package.
Ans : rpm -ivh –test packagename

Q: How to check that a particular file belong to which package
Ans : rpm -qf filename

Q: How to list files in  a package
Ans : rpm -ql packagename

Q: How to verify whether the files installed by package are intact or been tampered/corrupted.
Ans : rpm -qs packagename

Q: What is the command to create a new RPM Database
Ans : rpm –initdb

Q: What is the command to rebuild the RPM Database
Ans : rpm –rebuilddb

New MSI Interview Questions.


  1. How to add font files in an MSI package without using Wise Package Studio’s File Display Section.
  2. Difference between deferred & immediate custom action.
  3. What will you do if you can’t solve a issue in a package.
  4. How to add shortcuts to startup folder.
  5. Which applications should not be repackaged in MSI
  6. Which & why files are stored in C:\Windows\Installer
  7. What are the differences between patching, update & upgrade
  8. How to view to installation log files, which third party tools can be used for this task.
  9. Where can I find the schema of MSI file.
  10. How will you get the table details by using MSI SDK but not using ORCA.
  11. How can Network Shortcuts be added in an MSI Package.
  12. How to install certifications using MSI
  13. What are the advantages of admin install
  14. What condition on CA will allow to “Install” and “repair” but not at “uninstall”
  15. How to create nested MSI Installation
  16. How to create MST file from two MSI files.
  17. How to ensure that MSI gets installed only on WinXPSP3, win 7 and IE 8

Restarted working on mayaDeploy


I have restarted the coding of mayadeploy, a Full Package Management Solution for Small Business, It will be re-coded in Python & G++, using WX as GUI library.

Few silent features are as follows,

  1. Based on Server & Client architecture
  2. Using this managers will be able to deploy packages on to his reportee’s computer without any human intervention. (Only for App-V Packages for now)
  3. Will support following file types for deployment:- msi, exe, batch files, App-V Packages
  4. Ver: 2 will support even hardware & software reporting
  5. Will have entire Software Life cycle support.
    1. New Software request or Existing Software request
    2. Integration, packaging, UAT and Deployment lifecycle integrated.

as always i am requesting yours comments and suggestions to make it a success.

Alpha 1 Version of App-V Interview Questions


Dear All,

My first try to consolidate all the app-v interview questions. http://sourceforge.net/projects/softgridhelper/files/Documentations/AppV%20Interview%20Questions_Ver_0.0.1Alpha1.pdf/download

As always your comments and suggestions are most welcome.

Enjoy,

Mayank Johri

updated MSI Questions. Ver.: Alpha 4


Hello all,

I have updated the MSI Interview Questions, the updated document can be downloaded from http://sourceforge.net/projects/mayadeploy/files/FAQ/FAQ%20on%20MSI%20packaging%20and%20repackaging_0.0_1Beta4.pdf/download.

Enjoy solving the last 3 questions.

As always the questions & answers might be wrong.

🙂 so please correct me if that is the case :).

Enjoy,

Mayank Johri

FAQ: Valid OS Tag Values in an OSD File.


Target OS OSD Tag Value Minimal AppV Client
Windows NT VALUE=”WinNT”/> 4.1
Windows 2000 VALUE=”Win2K”/> 4.1
Windows 2000 Server VALUE=”Win2KSvr”/> 4.1
Windows 2000 Terminal Server VALUE=”Win2KTS”/> 4.1
Windows XP VALUE=”WinXP”/> 4.1
Windows XP x64 VALUE=”WinXP64″/> 4.6 x64
Windows Server 2003 VALUE=”Win2003Svr”/> 4.1
Windows Server 2003 Terminal Server VALUE=”Win2003TS”/> 4.1
Windows 2003 Terminal Server x64 VALUE=”Win2003TS64″/> 4.6 x64
Windows Vista VALUE=”WinVista”/> 4.2
Windows Vista x64 VALUE=”WinVista64″/> 4.6 x64
Windows 2008 Terminal Server VALUE=”Win2008TS”/> 4.5
Windows 2008 Terminal Server x64 VALUE=”Win2008TS64″/> 4.6 x64
Windows 7 VALUE=”Win7″/> 4.5 sp1
Windows 7 x64 VALUE=”Win764″/> 4.6 x64
Windows 2008 R2 Terminal Server x64 VALUE=”Win2008R2TS64″/> 4.6 x64