Wise Script...
I want to make a wise script to enumerate the Patches installed on a particular product using Wise Script.I am using the Call dll function and executing "MsiEnumPatchesA". The function as per msdn is described as UINT MsiEnumPatches(
__in LPCTSTR szProduct,
__in DWORD iPatchIndex,
__out LPTSTR lpPatchBuf,
__out LPTSTR lpTransformsBuf,
__inout DWORD *pcchTransformsBuf
);
How do i get out the LPSTR LpPatchBuf.If i try to get this value in a string buffer i get an empty value.I tried reading help but not able to make this work. Please suggest.
__in LPCTSTR szProduct,
__in DWORD iPatchIndex,
__out LPTSTR lpPatchBuf,
__out LPTSTR lpTransformsBuf,
__inout DWORD *pcchTransformsBuf
);
How do i get out the LPSTR LpPatchBuf.If i try to get this value in a string buffer i get an empty value.I tried reading help but not able to make this work. Please suggest.
0 Comments
[ + ] Show comments
Answers (2)
Please log in to answer
Posted by:
blacklisted_packager
15 years ago
Was i not able to frame the question properly ? I have managed to make a vbs to do that same..just want to use the wisescript call dll method.Attaching the vbs code...maybe someone can help me now..
' PatchRead.vbs
' VBScript program to read the patch applied to a particular product
'
' ----------------------------------------------------------------------
' Copyright (c) 2009 Karan Gupta
' Version 1.0 - April 16, 2009
Set installer = Wscript.CreateObject("WindowsInstaller.installer"): CheckError
set list1=installer.patches("{90120000-0011-0000-0000-0000000FF1CE}",0): CheckError
for each list in list1
'if list="{BEE75E01-DD3F-4D5F-B96C-609E6538D419}" then
Wscript.echo(list)
'end if
next
Sub CheckError
Dim message, errRec
If Err = 0 Then Exit Sub
message = Err.Source & " " & Hex(Err) & ": " & Err.Description
If Not installer Is Nothing Then
Set errRec = installer.LastErrorRecord
If Not errRec Is Nothing Then message = message & vbNewLine & errRec.FormatText
End If
Wscript.Echo message
Wscript.Quit 2
End Sub
' PatchRead.vbs
' VBScript program to read the patch applied to a particular product
'
' ----------------------------------------------------------------------
' Copyright (c) 2009 Karan Gupta
' Version 1.0 - April 16, 2009
Set installer = Wscript.CreateObject("WindowsInstaller.installer"): CheckError
set list1=installer.patches("{90120000-0011-0000-0000-0000000FF1CE}",0): CheckError
for each list in list1
'if list="{BEE75E01-DD3F-4D5F-B96C-609E6538D419}" then
Wscript.echo(list)
'end if
next
Sub CheckError
Dim message, errRec
If Err = 0 Then Exit Sub
message = Err.Source & " " & Hex(Err) & ": " & Err.Description
If Not installer Is Nothing Then
Set errRec = installer.LastErrorRecord
If Not errRec Is Nothing Then message = message & vbNewLine & errRec.FormatText
End If
Wscript.Echo message
Wscript.Quit 2
End Sub
Posted by:
anonymous_9363
15 years ago
I know nothing about WiseScript but I can tell you that lpPatchBuf is of type LPTSTR, i.e. a long pointer to the string, not the string itself. I imagine that you'd need to use the CopyMemory API to get that data. Along with that comes the possibility, with just one misplaced or incorrect data type, of crashing the machine. Your VBS works because the interpreter does the necessary work "out of sight".
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
so that the conversation will remain readable.