Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
8617161a
Kaydet (Commit)
8617161a
authored
May 09, 2010
tarafından
Antoine Pitrou
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixup indentation of PC/_msi.c
üst
c83ea137
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
355 additions
and
355 deletions
+355
-355
_msi.c
PC/_msi.c
+355
-355
No files found.
PC/_msi.c
Dosyayı görüntüle @
8617161a
...
@@ -26,13 +26,13 @@ uuidcreate(PyObject* obj, PyObject*args)
...
@@ -26,13 +26,13 @@ uuidcreate(PyObject* obj, PyObject*args)
For RPC_S_UUID_NO_ADDRESS, it's not clear whether we can
For RPC_S_UUID_NO_ADDRESS, it's not clear whether we can
use the result. */
use the result. */
if
(
UuidCreate
(
&
result
)
==
RPC_S_UUID_NO_ADDRESS
)
{
if
(
UuidCreate
(
&
result
)
==
RPC_S_UUID_NO_ADDRESS
)
{
PyErr_SetString
(
PyExc_NotImplementedError
,
"processing 'no address' result"
);
PyErr_SetString
(
PyExc_NotImplementedError
,
"processing 'no address' result"
);
return
NULL
;
return
NULL
;
}
}
if
(
UuidToString
(
&
result
,
&
cresult
)
==
RPC_S_OUT_OF_MEMORY
)
{
if
(
UuidToString
(
&
result
,
&
cresult
)
==
RPC_S_OUT_OF_MEMORY
)
{
PyErr_SetString
(
PyExc_MemoryError
,
"out of memory in uuidgen"
);
PyErr_SetString
(
PyExc_MemoryError
,
"out of memory in uuidgen"
);
return
NULL
;
return
NULL
;
}
}
oresult
=
PyString_FromString
(
cresult
);
oresult
=
PyString_FromString
(
cresult
);
...
@@ -57,7 +57,7 @@ static FNFCIOPEN(cb_open)
...
@@ -57,7 +57,7 @@ static FNFCIOPEN(cb_open)
{
{
int
result
=
_open
(
pszFile
,
oflag
,
pmode
);
int
result
=
_open
(
pszFile
,
oflag
,
pmode
);
if
(
result
==
-
1
)
if
(
result
==
-
1
)
*
err
=
errno
;
*
err
=
errno
;
return
result
;
return
result
;
}
}
...
@@ -65,7 +65,7 @@ static FNFCIREAD(cb_read)
...
@@ -65,7 +65,7 @@ static FNFCIREAD(cb_read)
{
{
UINT
result
=
(
UINT
)
_read
(
hf
,
memory
,
cb
);
UINT
result
=
(
UINT
)
_read
(
hf
,
memory
,
cb
);
if
(
result
!=
cb
)
if
(
result
!=
cb
)
*
err
=
errno
;
*
err
=
errno
;
return
result
;
return
result
;
}
}
...
@@ -73,7 +73,7 @@ static FNFCIWRITE(cb_write)
...
@@ -73,7 +73,7 @@ static FNFCIWRITE(cb_write)
{
{
UINT
result
=
(
UINT
)
_write
(
hf
,
memory
,
cb
);
UINT
result
=
(
UINT
)
_write
(
hf
,
memory
,
cb
);
if
(
result
!=
cb
)
if
(
result
!=
cb
)
*
err
=
errno
;
*
err
=
errno
;
return
result
;
return
result
;
}
}
...
@@ -81,7 +81,7 @@ static FNFCICLOSE(cb_close)
...
@@ -81,7 +81,7 @@ static FNFCICLOSE(cb_close)
{
{
int
result
=
_close
(
hf
);
int
result
=
_close
(
hf
);
if
(
result
!=
0
)
if
(
result
!=
0
)
*
err
=
errno
;
*
err
=
errno
;
return
result
;
return
result
;
}
}
...
@@ -89,7 +89,7 @@ static FNFCISEEK(cb_seek)
...
@@ -89,7 +89,7 @@ static FNFCISEEK(cb_seek)
{
{
long
result
=
(
long
)
_lseek
(
hf
,
dist
,
seektype
);
long
result
=
(
long
)
_lseek
(
hf
,
dist
,
seektype
);
if
(
result
==
-
1
)
if
(
result
==
-
1
)
*
err
=
errno
;
*
err
=
errno
;
return
result
;
return
result
;
}
}
...
@@ -97,7 +97,7 @@ static FNFCIDELETE(cb_delete)
...
@@ -97,7 +97,7 @@ static FNFCIDELETE(cb_delete)
{
{
int
result
=
remove
(
pszFile
);
int
result
=
remove
(
pszFile
);
if
(
result
!=
0
)
if
(
result
!=
0
)
*
err
=
errno
;
*
err
=
errno
;
return
result
;
return
result
;
}
}
...
@@ -110,9 +110,9 @@ static FNFCIGETTEMPFILE(cb_gettempfile)
...
@@ -110,9 +110,9 @@ static FNFCIGETTEMPFILE(cb_gettempfile)
{
{
char
*
name
=
_tempnam
(
""
,
"tmp"
);
char
*
name
=
_tempnam
(
""
,
"tmp"
);
if
((
name
!=
NULL
)
&&
((
int
)
strlen
(
name
)
<
cbTempName
))
{
if
((
name
!=
NULL
)
&&
((
int
)
strlen
(
name
)
<
cbTempName
))
{
strcpy
(
pszTempName
,
name
);
strcpy
(
pszTempName
,
name
);
free
(
name
);
free
(
name
);
return
TRUE
;
return
TRUE
;
}
}
if
(
name
)
free
(
name
);
if
(
name
)
free
(
name
);
...
@@ -122,10 +122,10 @@ static FNFCIGETTEMPFILE(cb_gettempfile)
...
@@ -122,10 +122,10 @@ static FNFCIGETTEMPFILE(cb_gettempfile)
static
FNFCISTATUS
(
cb_status
)
static
FNFCISTATUS
(
cb_status
)
{
{
if
(
pv
)
{
if
(
pv
)
{
PyObject
*
result
=
PyObject_CallMethod
(
pv
,
"status"
,
"iii"
,
typeStatus
,
cb1
,
cb2
);
PyObject
*
result
=
PyObject_CallMethod
(
pv
,
"status"
,
"iii"
,
typeStatus
,
cb1
,
cb2
);
if
(
result
==
NULL
)
if
(
result
==
NULL
)
return
-
1
;
return
-
1
;
Py_DECREF
(
result
);
Py_DECREF
(
result
);
}
}
return
0
;
return
0
;
}
}
...
@@ -133,18 +133,18 @@ static FNFCISTATUS(cb_status)
...
@@ -133,18 +133,18 @@ static FNFCISTATUS(cb_status)
static
FNFCIGETNEXTCABINET
(
cb_getnextcabinet
)
static
FNFCIGETNEXTCABINET
(
cb_getnextcabinet
)
{
{
if
(
pv
)
{
if
(
pv
)
{
PyObject
*
result
=
PyObject_CallMethod
(
pv
,
"getnextcabinet"
,
"i"
,
pccab
->
iCab
);
PyObject
*
result
=
PyObject_CallMethod
(
pv
,
"getnextcabinet"
,
"i"
,
pccab
->
iCab
);
if
(
result
==
NULL
)
if
(
result
==
NULL
)
return
-
1
;
return
-
1
;
if
(
!
PyString_Check
(
result
))
{
if
(
!
PyString_Check
(
result
))
{
PyErr_Format
(
PyExc_TypeError
,
PyErr_Format
(
PyExc_TypeError
,
"Incorrect return type %s from getnextcabinet"
,
"Incorrect return type %s from getnextcabinet"
,
result
->
ob_type
->
tp_name
);
result
->
ob_type
->
tp_name
);
Py_DECREF
(
result
);
Py_DECREF
(
result
);
return
FALSE
;
return
FALSE
;
}
}
strncpy
(
pccab
->
szCab
,
PyString_AsString
(
result
),
sizeof
(
pccab
->
szCab
));
strncpy
(
pccab
->
szCab
,
PyString_AsString
(
result
),
sizeof
(
pccab
->
szCab
));
return
TRUE
;
return
TRUE
;
}
}
return
FALSE
;
return
FALSE
;
}
}
...
@@ -157,21 +157,21 @@ static FNFCIGETOPENINFO(cb_getopeninfo)
...
@@ -157,21 +157,21 @@ static FNFCIGETOPENINFO(cb_getopeninfo)
/* Need Win32 handle to get time stamps */
/* Need Win32 handle to get time stamps */
handle
=
CreateFile
(
pszName
,
GENERIC_READ
,
FILE_SHARE_READ
,
NULL
,
handle
=
CreateFile
(
pszName
,
GENERIC_READ
,
FILE_SHARE_READ
,
NULL
,
OPEN_EXISTING
,
FILE_ATTRIBUTE_NORMAL
,
NULL
);
OPEN_EXISTING
,
FILE_ATTRIBUTE_NORMAL
,
NULL
);
if
(
handle
==
INVALID_HANDLE_VALUE
)
if
(
handle
==
INVALID_HANDLE_VALUE
)
return
-
1
;
return
-
1
;
if
(
GetFileInformationByHandle
(
handle
,
&
bhfi
)
==
FALSE
)
if
(
GetFileInformationByHandle
(
handle
,
&
bhfi
)
==
FALSE
)
{
{
CloseHandle
(
handle
);
CloseHandle
(
handle
);
return
-
1
;
return
-
1
;
}
}
FileTimeToLocalFileTime
(
&
bhfi
.
ftLastWriteTime
,
&
filetime
);
FileTimeToLocalFileTime
(
&
bhfi
.
ftLastWriteTime
,
&
filetime
);
FileTimeToDosDateTime
(
&
filetime
,
pdate
,
ptime
);
FileTimeToDosDateTime
(
&
filetime
,
pdate
,
ptime
);
*
pattribs
=
(
int
)(
bhfi
.
dwFileAttributes
&
*
pattribs
=
(
int
)(
bhfi
.
dwFileAttributes
&
(
_A_RDONLY
|
_A_SYSTEM
|
_A_HIDDEN
|
_A_ARCH
));
(
_A_RDONLY
|
_A_SYSTEM
|
_A_HIDDEN
|
_A_ARCH
));
CloseHandle
(
handle
);
CloseHandle
(
handle
);
...
@@ -189,11 +189,11 @@ static PyObject* fcicreate(PyObject* obj, PyObject* args)
...
@@ -189,11 +189,11 @@ static PyObject* fcicreate(PyObject* obj, PyObject* args)
if
(
!
PyArg_ParseTuple
(
args
,
"sO:FCICreate"
,
&
cabname
,
&
files
))
if
(
!
PyArg_ParseTuple
(
args
,
"sO:FCICreate"
,
&
cabname
,
&
files
))
return
NULL
;
return
NULL
;
if
(
!
PyList_Check
(
files
))
{
if
(
!
PyList_Check
(
files
))
{
PyErr_SetString
(
PyExc_TypeError
,
"FCICreate expects a list"
);
PyErr_SetString
(
PyExc_TypeError
,
"FCICreate expects a list"
);
return
NULL
;
return
NULL
;
}
}
ccab
.
cb
=
INT_MAX
;
/* no need to split CAB into multiple media */
ccab
.
cb
=
INT_MAX
;
/* no need to split CAB into multiple media */
...
@@ -209,49 +209,49 @@ static PyObject* fcicreate(PyObject* obj, PyObject* args)
...
@@ -209,49 +209,49 @@ static PyObject* fcicreate(PyObject* obj, PyObject* args)
ccab
.
szDisk
[
0
]
=
'\0'
;
ccab
.
szDisk
[
0
]
=
'\0'
;
for
(
i
=
0
,
p
=
cabname
;
*
p
;
p
=
CharNext
(
p
))
for
(
i
=
0
,
p
=
cabname
;
*
p
;
p
=
CharNext
(
p
))
if
(
*
p
==
'\\'
||
*
p
==
'/'
)
if
(
*
p
==
'\\'
||
*
p
==
'/'
)
i
=
p
-
cabname
+
1
;
i
=
p
-
cabname
+
1
;
if
(
i
>=
sizeof
(
ccab
.
szCabPath
)
||
if
(
i
>=
sizeof
(
ccab
.
szCabPath
)
||
strlen
(
cabname
+
i
)
>=
sizeof
(
ccab
.
szCab
))
{
strlen
(
cabname
+
i
)
>=
sizeof
(
ccab
.
szCab
))
{
PyErr_SetString
(
PyExc_ValueError
,
"path name too long"
);
PyErr_SetString
(
PyExc_ValueError
,
"path name too long"
);
return
0
;
return
0
;
}
}
if
(
i
>
0
)
{
if
(
i
>
0
)
{
memcpy
(
ccab
.
szCabPath
,
cabname
,
i
);
memcpy
(
ccab
.
szCabPath
,
cabname
,
i
);
ccab
.
szCabPath
[
i
]
=
'\0'
;
ccab
.
szCabPath
[
i
]
=
'\0'
;
strcpy
(
ccab
.
szCab
,
cabname
+
i
);
strcpy
(
ccab
.
szCab
,
cabname
+
i
);
}
else
{
}
else
{
strcpy
(
ccab
.
szCabPath
,
".
\\
"
);
strcpy
(
ccab
.
szCabPath
,
".
\\
"
);
strcpy
(
ccab
.
szCab
,
cabname
);
strcpy
(
ccab
.
szCab
,
cabname
);
}
}
hfci
=
FCICreate
(
&
erf
,
cb_fileplaced
,
cb_alloc
,
cb_free
,
hfci
=
FCICreate
(
&
erf
,
cb_fileplaced
,
cb_alloc
,
cb_free
,
cb_open
,
cb_read
,
cb_write
,
cb_close
,
cb_seek
,
cb_delete
,
cb_open
,
cb_read
,
cb_write
,
cb_close
,
cb_seek
,
cb_delete
,
cb_gettempfile
,
&
ccab
,
NULL
);
cb_gettempfile
,
&
ccab
,
NULL
);
if
(
hfci
==
NULL
)
{
if
(
hfci
==
NULL
)
{
PyErr_Format
(
PyExc_ValueError
,
"FCI error %d"
,
erf
.
erfOper
);
PyErr_Format
(
PyExc_ValueError
,
"FCI error %d"
,
erf
.
erfOper
);
return
NULL
;
return
NULL
;
}
}
for
(
i
=
0
;
i
<
PyList_GET_SIZE
(
files
);
i
++
)
{
for
(
i
=
0
;
i
<
PyList_GET_SIZE
(
files
);
i
++
)
{
PyObject
*
item
=
PyList_GET_ITEM
(
files
,
i
);
PyObject
*
item
=
PyList_GET_ITEM
(
files
,
i
);
char
*
filename
,
*
cabname
;
char
*
filename
,
*
cabname
;
if
(
!
PyArg_ParseTuple
(
item
,
"ss"
,
&
filename
,
&
cabname
))
if
(
!
PyArg_ParseTuple
(
item
,
"ss"
,
&
filename
,
&
cabname
))
goto
err
;
goto
err
;
if
(
!
FCIAddFile
(
hfci
,
filename
,
cabname
,
FALSE
,
if
(
!
FCIAddFile
(
hfci
,
filename
,
cabname
,
FALSE
,
cb_getnextcabinet
,
cb_status
,
cb_getopeninfo
,
cb_getnextcabinet
,
cb_status
,
cb_getopeninfo
,
tcompTYPE_MSZIP
))
tcompTYPE_MSZIP
))
goto
err
;
goto
err
;
}
}
if
(
!
FCIFlushCabinet
(
hfci
,
FALSE
,
cb_getnextcabinet
,
cb_status
))
if
(
!
FCIFlushCabinet
(
hfci
,
FALSE
,
cb_getnextcabinet
,
cb_status
))
goto
err
;
goto
err
;
if
(
!
FCIDestroy
(
hfci
))
if
(
!
FCIDestroy
(
hfci
))
goto
err
;
goto
err
;
Py_INCREF
(
Py_None
);
Py_INCREF
(
Py_None
);
return
Py_None
;
return
Py_None
;
...
@@ -292,41 +292,41 @@ msierror(int status)
...
@@ -292,41 +292,41 @@ msierror(int status)
MSIHANDLE
err
=
MsiGetLastErrorRecord
();
MSIHANDLE
err
=
MsiGetLastErrorRecord
();
if
(
err
==
0
)
{
if
(
err
==
0
)
{
switch
(
status
)
{
switch
(
status
)
{
case
ERROR_ACCESS_DENIED
:
case
ERROR_ACCESS_DENIED
:
PyErr_SetString
(
MSIError
,
"access denied"
);
PyErr_SetString
(
MSIError
,
"access denied"
);
return
NULL
;
return
NULL
;
case
ERROR_FUNCTION_FAILED
:
case
ERROR_FUNCTION_FAILED
:
PyErr_SetString
(
MSIError
,
"function failed"
);
PyErr_SetString
(
MSIError
,
"function failed"
);
return
NULL
;
return
NULL
;
case
ERROR_INVALID_DATA
:
case
ERROR_INVALID_DATA
:
PyErr_SetString
(
MSIError
,
"invalid data"
);
PyErr_SetString
(
MSIError
,
"invalid data"
);
return
NULL
;
return
NULL
;
case
ERROR_INVALID_HANDLE
:
case
ERROR_INVALID_HANDLE
:
PyErr_SetString
(
MSIError
,
"invalid handle"
);
PyErr_SetString
(
MSIError
,
"invalid handle"
);
return
NULL
;
return
NULL
;
case
ERROR_INVALID_STATE
:
case
ERROR_INVALID_STATE
:
PyErr_SetString
(
MSIError
,
"invalid state"
);
PyErr_SetString
(
MSIError
,
"invalid state"
);
return
NULL
;
return
NULL
;
case
ERROR_INVALID_PARAMETER
:
case
ERROR_INVALID_PARAMETER
:
PyErr_SetString
(
MSIError
,
"invalid parameter"
);
PyErr_SetString
(
MSIError
,
"invalid parameter"
);
return
NULL
;
return
NULL
;
default:
default:
PyErr_Format
(
MSIError
,
"unknown error %x"
,
status
);
PyErr_Format
(
MSIError
,
"unknown error %x"
,
status
);
return
NULL
;
return
NULL
;
}
}
}
}
code
=
MsiRecordGetInteger
(
err
,
1
);
/* XXX code */
code
=
MsiRecordGetInteger
(
err
,
1
);
/* XXX code */
if
(
MsiFormatRecord
(
0
,
err
,
res
,
&
size
)
==
ERROR_MORE_DATA
)
{
if
(
MsiFormatRecord
(
0
,
err
,
res
,
&
size
)
==
ERROR_MORE_DATA
)
{
res
=
malloc
(
size
+
1
);
res
=
malloc
(
size
+
1
);
MsiFormatRecord
(
0
,
err
,
res
,
&
size
);
MsiFormatRecord
(
0
,
err
,
res
,
&
size
);
res
[
size
]
=
'\0'
;
res
[
size
]
=
'\0'
;
}
}
MsiCloseHandle
(
err
);
MsiCloseHandle
(
err
);
PyErr_SetString
(
MSIError
,
res
);
PyErr_SetString
(
MSIError
,
res
);
if
(
res
!=
buf
)
if
(
res
!=
buf
)
free
(
res
);
free
(
res
);
return
NULL
;
return
NULL
;
}
}
...
@@ -345,11 +345,11 @@ record_getinteger(msiobj* record, PyObject* args)
...
@@ -345,11 +345,11 @@ record_getinteger(msiobj* record, PyObject* args)
int
status
;
int
status
;
if
(
!
PyArg_ParseTuple
(
args
,
"I:GetInteger"
,
&
field
))
if
(
!
PyArg_ParseTuple
(
args
,
"I:GetInteger"
,
&
field
))
return
NULL
;
return
NULL
;
status
=
MsiRecordGetInteger
(
record
->
h
,
field
);
status
=
MsiRecordGetInteger
(
record
->
h
,
field
);
if
(
status
==
MSI_NULL_INTEGER
){
if
(
status
==
MSI_NULL_INTEGER
){
PyErr_SetString
(
MSIError
,
"could not convert record field to integer"
);
PyErr_SetString
(
MSIError
,
"could not convert record field to integer"
);
return
NULL
;
return
NULL
;
}
}
return
PyInt_FromLong
((
long
)
status
);
return
PyInt_FromLong
((
long
)
status
);
}
}
...
@@ -365,19 +365,19 @@ record_getstring(msiobj* record, PyObject* args)
...
@@ -365,19 +365,19 @@ record_getstring(msiobj* record, PyObject* args)
PyObject
*
string
;
PyObject
*
string
;
if
(
!
PyArg_ParseTuple
(
args
,
"I:GetString"
,
&
field
))
if
(
!
PyArg_ParseTuple
(
args
,
"I:GetString"
,
&
field
))
return
NULL
;
return
NULL
;
status
=
MsiRecordGetString
(
record
->
h
,
field
,
res
,
&
size
);
status
=
MsiRecordGetString
(
record
->
h
,
field
,
res
,
&
size
);
if
(
status
==
ERROR_MORE_DATA
)
{
if
(
status
==
ERROR_MORE_DATA
)
{
res
=
(
char
*
)
malloc
(
size
+
1
);
res
=
(
char
*
)
malloc
(
size
+
1
);
if
(
res
==
NULL
)
if
(
res
==
NULL
)
return
PyErr_NoMemory
();
return
PyErr_NoMemory
();
status
=
MsiRecordGetString
(
record
->
h
,
field
,
res
,
&
size
);
status
=
MsiRecordGetString
(
record
->
h
,
field
,
res
,
&
size
);
}
}
if
(
status
!=
ERROR_SUCCESS
)
if
(
status
!=
ERROR_SUCCESS
)
return
msierror
((
int
)
status
);
return
msierror
((
int
)
status
);
string
=
PyString_FromString
(
res
);
string
=
PyString_FromString
(
res
);
if
(
buf
!=
res
)
if
(
buf
!=
res
)
free
(
res
);
free
(
res
);
return
string
;
return
string
;
}
}
...
@@ -386,7 +386,7 @@ record_cleardata(msiobj* record, PyObject *args)
...
@@ -386,7 +386,7 @@ record_cleardata(msiobj* record, PyObject *args)
{
{
int
status
=
MsiRecordClearData
(
record
->
h
);
int
status
=
MsiRecordClearData
(
record
->
h
);
if
(
status
!=
ERROR_SUCCESS
)
if
(
status
!=
ERROR_SUCCESS
)
return
msierror
(
status
);
return
msierror
(
status
);
Py_INCREF
(
Py_None
);
Py_INCREF
(
Py_None
);
return
Py_None
;
return
Py_None
;
...
@@ -400,10 +400,10 @@ record_setstring(msiobj* record, PyObject *args)
...
@@ -400,10 +400,10 @@ record_setstring(msiobj* record, PyObject *args)
char
*
data
;
char
*
data
;
if
(
!
PyArg_ParseTuple
(
args
,
"is:SetString"
,
&
field
,
&
data
))
if
(
!
PyArg_ParseTuple
(
args
,
"is:SetString"
,
&
field
,
&
data
))
return
NULL
;
return
NULL
;
if
((
status
=
MsiRecordSetString
(
record
->
h
,
field
,
data
))
!=
ERROR_SUCCESS
)
if
((
status
=
MsiRecordSetString
(
record
->
h
,
field
,
data
))
!=
ERROR_SUCCESS
)
return
msierror
(
status
);
return
msierror
(
status
);
Py_INCREF
(
Py_None
);
Py_INCREF
(
Py_None
);
return
Py_None
;
return
Py_None
;
...
@@ -417,10 +417,10 @@ record_setstream(msiobj* record, PyObject *args)
...
@@ -417,10 +417,10 @@ record_setstream(msiobj* record, PyObject *args)
char
*
data
;
char
*
data
;
if
(
!
PyArg_ParseTuple
(
args
,
"is:SetStream"
,
&
field
,
&
data
))
if
(
!
PyArg_ParseTuple
(
args
,
"is:SetStream"
,
&
field
,
&
data
))
return
NULL
;
return
NULL
;
if
((
status
=
MsiRecordSetStream
(
record
->
h
,
field
,
data
))
!=
ERROR_SUCCESS
)
if
((
status
=
MsiRecordSetStream
(
record
->
h
,
field
,
data
))
!=
ERROR_SUCCESS
)
return
msierror
(
status
);
return
msierror
(
status
);
Py_INCREF
(
Py_None
);
Py_INCREF
(
Py_None
);
return
Py_None
;
return
Py_None
;
...
@@ -434,10 +434,10 @@ record_setinteger(msiobj* record, PyObject *args)
...
@@ -434,10 +434,10 @@ record_setinteger(msiobj* record, PyObject *args)
int
data
;
int
data
;
if
(
!
PyArg_ParseTuple
(
args
,
"ii:SetInteger"
,
&
field
,
&
data
))
if
(
!
PyArg_ParseTuple
(
args
,
"ii:SetInteger"
,
&
field
,
&
data
))
return
NULL
;
return
NULL
;
if
((
status
=
MsiRecordSetInteger
(
record
->
h
,
field
,
data
))
!=
ERROR_SUCCESS
)
if
((
status
=
MsiRecordSetInteger
(
record
->
h
,
field
,
data
))
!=
ERROR_SUCCESS
)
return
msierror
(
status
);
return
msierror
(
status
);
Py_INCREF
(
Py_None
);
Py_INCREF
(
Py_None
);
return
Py_None
;
return
Py_None
;
...
@@ -447,64 +447,64 @@ record_setinteger(msiobj* record, PyObject *args)
...
@@ -447,64 +447,64 @@ record_setinteger(msiobj* record, PyObject *args)
static
PyMethodDef
record_methods
[]
=
{
static
PyMethodDef
record_methods
[]
=
{
{
"GetFieldCount"
,
(
PyCFunction
)
record_getfieldcount
,
METH_NOARGS
,
{
"GetFieldCount"
,
(
PyCFunction
)
record_getfieldcount
,
METH_NOARGS
,
PyDoc_STR
(
"GetFieldCount() -> int
\n
Wraps MsiRecordGetFieldCount"
)},
PyDoc_STR
(
"GetFieldCount() -> int
\n
Wraps MsiRecordGetFieldCount"
)},
{
"GetInteger"
,
(
PyCFunction
)
record_getinteger
,
METH_VARARGS
,
{
"GetInteger"
,
(
PyCFunction
)
record_getinteger
,
METH_VARARGS
,
PyDoc_STR
(
"GetInteger(field) -> int
\n
Wraps MsiRecordGetInteger"
)},
PyDoc_STR
(
"GetInteger(field) -> int
\n
Wraps MsiRecordGetInteger"
)},
{
"GetString"
,
(
PyCFunction
)
record_getstring
,
METH_VARARGS
,
{
"GetString"
,
(
PyCFunction
)
record_getstring
,
METH_VARARGS
,
PyDoc_STR
(
"GetString(field) -> string
\n
Wraps MsiRecordGetString"
)},
PyDoc_STR
(
"GetString(field) -> string
\n
Wraps MsiRecordGetString"
)},
{
"SetString"
,
(
PyCFunction
)
record_setstring
,
METH_VARARGS
,
{
"SetString"
,
(
PyCFunction
)
record_setstring
,
METH_VARARGS
,
PyDoc_STR
(
"SetString(field,str) -> None
\n
Wraps MsiRecordSetString"
)},
PyDoc_STR
(
"SetString(field,str) -> None
\n
Wraps MsiRecordSetString"
)},
{
"SetStream"
,
(
PyCFunction
)
record_setstream
,
METH_VARARGS
,
{
"SetStream"
,
(
PyCFunction
)
record_setstream
,
METH_VARARGS
,
PyDoc_STR
(
"SetStream(field,filename) -> None
\n
Wraps MsiRecordSetInteger"
)},
PyDoc_STR
(
"SetStream(field,filename) -> None
\n
Wraps MsiRecordSetInteger"
)},
{
"SetInteger"
,
(
PyCFunction
)
record_setinteger
,
METH_VARARGS
,
{
"SetInteger"
,
(
PyCFunction
)
record_setinteger
,
METH_VARARGS
,
PyDoc_STR
(
"SetInteger(field,int) -> None
\n
Wraps MsiRecordSetInteger"
)},
PyDoc_STR
(
"SetInteger(field,int) -> None
\n
Wraps MsiRecordSetInteger"
)},
{
"ClearData"
,
(
PyCFunction
)
record_cleardata
,
METH_NOARGS
,
{
"ClearData"
,
(
PyCFunction
)
record_cleardata
,
METH_NOARGS
,
PyDoc_STR
(
"ClearData() -> int
\n
Wraps MsiRecordGClearData"
)},
PyDoc_STR
(
"ClearData() -> int
\n
Wraps MsiRecordGClearData"
)},
{
NULL
,
NULL
}
{
NULL
,
NULL
}
};
};
static
PyTypeObject
record_Type
=
{
static
PyTypeObject
record_Type
=
{
PyVarObject_HEAD_INIT
(
NULL
,
0
)
PyVarObject_HEAD_INIT
(
NULL
,
0
)
"_msi.Record"
,
/*tp_name*/
"_msi.Record"
,
/*tp_name*/
sizeof
(
msiobj
),
/*tp_basicsize*/
sizeof
(
msiobj
),
/*tp_basicsize*/
0
,
/*tp_itemsize*/
0
,
/*tp_itemsize*/
/* methods */
/* methods */
(
destructor
)
msiobj_dealloc
,
/*tp_dealloc*/
(
destructor
)
msiobj_dealloc
,
/*tp_dealloc*/
0
,
/*tp_print*/
0
,
/*tp_print*/
0
,
/*tp_getattr*/
0
,
/*tp_getattr*/
0
,
/*tp_setattr*/
0
,
/*tp_setattr*/
0
,
/*tp_compare*/
0
,
/*tp_compare*/
0
,
/*tp_repr*/
0
,
/*tp_repr*/
0
,
/*tp_as_number*/
0
,
/*tp_as_number*/
0
,
/*tp_as_sequence*/
0
,
/*tp_as_sequence*/
0
,
/*tp_as_mapping*/
0
,
/*tp_as_mapping*/
0
,
/*tp_hash*/
0
,
/*tp_hash*/
0
,
/*tp_call*/
0
,
/*tp_call*/
0
,
/*tp_str*/
0
,
/*tp_str*/
PyObject_GenericGetAttr
,
/*tp_getattro*/
PyObject_GenericGetAttr
,
/*tp_getattro*/
PyObject_GenericSetAttr
,
/*tp_setattro*/
PyObject_GenericSetAttr
,
/*tp_setattro*/
0
,
/*tp_as_buffer*/
0
,
/*tp_as_buffer*/
Py_TPFLAGS_DEFAULT
,
/*tp_flags*/
Py_TPFLAGS_DEFAULT
,
/*tp_flags*/
0
,
/*tp_doc*/
0
,
/*tp_doc*/
0
,
/*tp_traverse*/
0
,
/*tp_traverse*/
0
,
/*tp_clear*/
0
,
/*tp_clear*/
0
,
/*tp_richcompare*/
0
,
/*tp_richcompare*/
0
,
/*tp_weaklistoffset*/
0
,
/*tp_weaklistoffset*/
0
,
/*tp_iter*/
0
,
/*tp_iter*/
0
,
/*tp_iternext*/
0
,
/*tp_iternext*/
record_methods
,
/*tp_methods*/
record_methods
,
/*tp_methods*/
0
,
/*tp_members*/
0
,
/*tp_members*/
0
,
/*tp_getset*/
0
,
/*tp_getset*/
0
,
/*tp_base*/
0
,
/*tp_base*/
0
,
/*tp_dict*/
0
,
/*tp_dict*/
0
,
/*tp_descr_get*/
0
,
/*tp_descr_get*/
0
,
/*tp_descr_set*/
0
,
/*tp_descr_set*/
0
,
/*tp_dictoffset*/
0
,
/*tp_dictoffset*/
0
,
/*tp_init*/
0
,
/*tp_init*/
0
,
/*tp_alloc*/
0
,
/*tp_alloc*/
0
,
/*tp_new*/
0
,
/*tp_new*/
0
,
/*tp_free*/
0
,
/*tp_free*/
0
,
/*tp_is_gc*/
0
,
/*tp_is_gc*/
};
};
static
PyObject
*
static
PyObject
*
...
@@ -513,8 +513,8 @@ record_new(MSIHANDLE h)
...
@@ -513,8 +513,8 @@ record_new(MSIHANDLE h)
msiobj
*
result
=
PyObject_NEW
(
struct
msiobj
,
&
record_Type
);
msiobj
*
result
=
PyObject_NEW
(
struct
msiobj
,
&
record_Type
);
if
(
!
result
)
{
if
(
!
result
)
{
MsiCloseHandle
(
h
);
MsiCloseHandle
(
h
);
return
NULL
;
return
NULL
;
}
}
result
->
h
=
h
;
result
->
h
=
h
;
...
@@ -537,27 +537,27 @@ summary_getproperty(msiobj* si, PyObject *args)
...
@@ -537,27 +537,27 @@ summary_getproperty(msiobj* si, PyObject *args)
DWORD
ssize
=
sizeof
(
sval
);
DWORD
ssize
=
sizeof
(
sval
);
if
(
!
PyArg_ParseTuple
(
args
,
"i:GetProperty"
,
&
field
))
if
(
!
PyArg_ParseTuple
(
args
,
"i:GetProperty"
,
&
field
))
return
NULL
;
return
NULL
;
status
=
MsiSummaryInfoGetProperty
(
si
->
h
,
field
,
&
type
,
&
ival
,
&
fval
,
sval
,
&
ssize
);
if
(
status
==
ERROR_MORE_DATA
)
{
sval
=
malloc
(
ssize
);
status
=
MsiSummaryInfoGetProperty
(
si
->
h
,
field
,
&
type
,
&
ival
,
status
=
MsiSummaryInfoGetProperty
(
si
->
h
,
field
,
&
type
,
&
ival
,
&
fval
,
sval
,
&
ssize
);
&
fval
,
sval
,
&
ssize
);
if
(
status
==
ERROR_MORE_DATA
)
{
sval
=
malloc
(
ssize
);
status
=
MsiSummaryInfoGetProperty
(
si
->
h
,
field
,
&
type
,
&
ival
,
&
fval
,
sval
,
&
ssize
);
}
}
switch
(
type
)
{
switch
(
type
)
{
case
VT_I2
:
case
VT_I4
:
case
VT_I2
:
case
VT_I4
:
return
PyInt_FromLong
(
ival
);
return
PyInt_FromLong
(
ival
);
case
VT_FILETIME
:
case
VT_FILETIME
:
PyErr_SetString
(
PyExc_NotImplementedError
,
"FILETIME result"
);
PyErr_SetString
(
PyExc_NotImplementedError
,
"FILETIME result"
);
return
NULL
;
return
NULL
;
case
VT_LPSTR
:
case
VT_LPSTR
:
result
=
PyString_FromStringAndSize
(
sval
,
ssize
);
result
=
PyString_FromStringAndSize
(
sval
,
ssize
);
if
(
sval
!=
sbuf
)
if
(
sval
!=
sbuf
)
free
(
sval
);
free
(
sval
);
return
result
;
return
result
;
}
}
PyErr_Format
(
PyExc_NotImplementedError
,
"result of type %d"
,
type
);
PyErr_Format
(
PyExc_NotImplementedError
,
"result of type %d"
,
type
);
return
NULL
;
return
NULL
;
...
@@ -571,7 +571,7 @@ summary_getpropertycount(msiobj* si, PyObject *args)
...
@@ -571,7 +571,7 @@ summary_getpropertycount(msiobj* si, PyObject *args)
status
=
MsiSummaryInfoGetPropertyCount
(
si
->
h
,
&
result
);
status
=
MsiSummaryInfoGetPropertyCount
(
si
->
h
,
&
result
);
if
(
status
!=
ERROR_SUCCESS
)
if
(
status
!=
ERROR_SUCCESS
)
return
msierror
(
status
);
return
msierror
(
status
);
return
PyInt_FromLong
(
result
);
return
PyInt_FromLong
(
result
);
}
}
...
@@ -584,21 +584,21 @@ summary_setproperty(msiobj* si, PyObject *args)
...
@@ -584,21 +584,21 @@ summary_setproperty(msiobj* si, PyObject *args)
PyObject
*
data
;
PyObject
*
data
;
if
(
!
PyArg_ParseTuple
(
args
,
"iO:SetProperty"
,
&
field
,
&
data
))
if
(
!
PyArg_ParseTuple
(
args
,
"iO:SetProperty"
,
&
field
,
&
data
))
return
NULL
;
return
NULL
;
if
(
PyString_Check
(
data
))
{
if
(
PyString_Check
(
data
))
{
status
=
MsiSummaryInfoSetProperty
(
si
->
h
,
field
,
VT_LPSTR
,
status
=
MsiSummaryInfoSetProperty
(
si
->
h
,
field
,
VT_LPSTR
,
0
,
NULL
,
PyString_AsString
(
data
));
0
,
NULL
,
PyString_AsString
(
data
));
}
else
if
(
PyInt_Check
(
data
))
{
}
else
if
(
PyInt_Check
(
data
))
{
status
=
MsiSummaryInfoSetProperty
(
si
->
h
,
field
,
VT_I4
,
status
=
MsiSummaryInfoSetProperty
(
si
->
h
,
field
,
VT_I4
,
PyInt_AsLong
(
data
),
NULL
,
NULL
);
PyInt_AsLong
(
data
),
NULL
,
NULL
);
}
else
{
}
else
{
PyErr_SetString
(
PyExc_TypeError
,
"unsupported type"
);
PyErr_SetString
(
PyExc_TypeError
,
"unsupported type"
);
return
NULL
;
return
NULL
;
}
}
if
(
status
!=
ERROR_SUCCESS
)
if
(
status
!=
ERROR_SUCCESS
)
return
msierror
(
status
);
return
msierror
(
status
);
Py_INCREF
(
Py_None
);
Py_INCREF
(
Py_None
);
return
Py_None
;
return
Py_None
;
...
@@ -612,65 +612,65 @@ summary_persist(msiobj* si, PyObject *args)
...
@@ -612,65 +612,65 @@ summary_persist(msiobj* si, PyObject *args)
status
=
MsiSummaryInfoPersist
(
si
->
h
);
status
=
MsiSummaryInfoPersist
(
si
->
h
);
if
(
status
!=
ERROR_SUCCESS
)
if
(
status
!=
ERROR_SUCCESS
)
return
msierror
(
status
);
return
msierror
(
status
);
Py_INCREF
(
Py_None
);
Py_INCREF
(
Py_None
);
return
Py_None
;
return
Py_None
;
}
}
static
PyMethodDef
summary_methods
[]
=
{
static
PyMethodDef
summary_methods
[]
=
{
{
"GetProperty"
,
(
PyCFunction
)
summary_getproperty
,
METH_VARARGS
,
{
"GetProperty"
,
(
PyCFunction
)
summary_getproperty
,
METH_VARARGS
,
PyDoc_STR
(
"GetProperty(propid) -> value
\n
Wraps MsiSummaryInfoGetProperty"
)},
PyDoc_STR
(
"GetProperty(propid) -> value
\n
Wraps MsiSummaryInfoGetProperty"
)},
{
"GetPropertyCount"
,
(
PyCFunction
)
summary_getpropertycount
,
METH_NOARGS
,
{
"GetPropertyCount"
,
(
PyCFunction
)
summary_getpropertycount
,
METH_NOARGS
,
PyDoc_STR
(
"GetProperty() -> int
\n
Wraps MsiSummaryInfoGetPropertyCount"
)},
PyDoc_STR
(
"GetProperty() -> int
\n
Wraps MsiSummaryInfoGetPropertyCount"
)},
{
"SetProperty"
,
(
PyCFunction
)
summary_setproperty
,
METH_VARARGS
,
{
"SetProperty"
,
(
PyCFunction
)
summary_setproperty
,
METH_VARARGS
,
PyDoc_STR
(
"SetProperty(value) -> None
\n
Wraps MsiSummaryInfoProperty"
)},
PyDoc_STR
(
"SetProperty(value) -> None
\n
Wraps MsiSummaryInfoProperty"
)},
{
"Persist"
,
(
PyCFunction
)
summary_persist
,
METH_NOARGS
,
{
"Persist"
,
(
PyCFunction
)
summary_persist
,
METH_NOARGS
,
PyDoc_STR
(
"Persist() -> None
\n
Wraps MsiSummaryInfoPersist"
)},
PyDoc_STR
(
"Persist() -> None
\n
Wraps MsiSummaryInfoPersist"
)},
{
NULL
,
NULL
}
{
NULL
,
NULL
}
};
};
static
PyTypeObject
summary_Type
=
{
static
PyTypeObject
summary_Type
=
{
PyVarObject_HEAD_INIT
(
NULL
,
0
)
PyVarObject_HEAD_INIT
(
NULL
,
0
)
"_msi.SummaryInformation"
,
/*tp_name*/
"_msi.SummaryInformation"
,
/*tp_name*/
sizeof
(
msiobj
),
/*tp_basicsize*/
sizeof
(
msiobj
),
/*tp_basicsize*/
0
,
/*tp_itemsize*/
0
,
/*tp_itemsize*/
/* methods */
/* methods */
(
destructor
)
msiobj_dealloc
,
/*tp_dealloc*/
(
destructor
)
msiobj_dealloc
,
/*tp_dealloc*/
0
,
/*tp_print*/
0
,
/*tp_print*/
0
,
/*tp_getattr*/
0
,
/*tp_getattr*/
0
,
/*tp_setattr*/
0
,
/*tp_setattr*/
0
,
/*tp_compare*/
0
,
/*tp_compare*/
0
,
/*tp_repr*/
0
,
/*tp_repr*/
0
,
/*tp_as_number*/
0
,
/*tp_as_number*/
0
,
/*tp_as_sequence*/
0
,
/*tp_as_sequence*/
0
,
/*tp_as_mapping*/
0
,
/*tp_as_mapping*/
0
,
/*tp_hash*/
0
,
/*tp_hash*/
0
,
/*tp_call*/
0
,
/*tp_call*/
0
,
/*tp_str*/
0
,
/*tp_str*/
PyObject_GenericGetAttr
,
/*tp_getattro*/
PyObject_GenericGetAttr
,
/*tp_getattro*/
PyObject_GenericSetAttr
,
/*tp_setattro*/
PyObject_GenericSetAttr
,
/*tp_setattro*/
0
,
/*tp_as_buffer*/
0
,
/*tp_as_buffer*/
Py_TPFLAGS_DEFAULT
,
/*tp_flags*/
Py_TPFLAGS_DEFAULT
,
/*tp_flags*/
0
,
/*tp_doc*/
0
,
/*tp_doc*/
0
,
/*tp_traverse*/
0
,
/*tp_traverse*/
0
,
/*tp_clear*/
0
,
/*tp_clear*/
0
,
/*tp_richcompare*/
0
,
/*tp_richcompare*/
0
,
/*tp_weaklistoffset*/
0
,
/*tp_weaklistoffset*/
0
,
/*tp_iter*/
0
,
/*tp_iter*/
0
,
/*tp_iternext*/
0
,
/*tp_iternext*/
summary_methods
,
/*tp_methods*/
summary_methods
,
/*tp_methods*/
0
,
/*tp_members*/
0
,
/*tp_members*/
0
,
/*tp_getset*/
0
,
/*tp_getset*/
0
,
/*tp_base*/
0
,
/*tp_base*/
0
,
/*tp_dict*/
0
,
/*tp_dict*/
0
,
/*tp_descr_get*/
0
,
/*tp_descr_get*/
0
,
/*tp_descr_set*/
0
,
/*tp_descr_set*/
0
,
/*tp_dictoffset*/
0
,
/*tp_dictoffset*/
0
,
/*tp_init*/
0
,
/*tp_init*/
0
,
/*tp_alloc*/
0
,
/*tp_alloc*/
0
,
/*tp_new*/
0
,
/*tp_new*/
0
,
/*tp_free*/
0
,
/*tp_free*/
0
,
/*tp_is_gc*/
0
,
/*tp_is_gc*/
};
};
/*************************** View objects **************/
/*************************** View objects **************/
...
@@ -683,19 +683,19 @@ view_execute(msiobj *view, PyObject*args)
...
@@ -683,19 +683,19 @@ view_execute(msiobj *view, PyObject*args)
PyObject
*
oparams
=
Py_None
;
PyObject
*
oparams
=
Py_None
;
if
(
!
PyArg_ParseTuple
(
args
,
"O:Execute"
,
&
oparams
))
if
(
!
PyArg_ParseTuple
(
args
,
"O:Execute"
,
&
oparams
))
return
NULL
;
return
NULL
;
if
(
oparams
!=
Py_None
)
{
if
(
oparams
!=
Py_None
)
{
if
(
oparams
->
ob_type
!=
&
record_Type
)
{
if
(
oparams
->
ob_type
!=
&
record_Type
)
{
PyErr_SetString
(
PyExc_TypeError
,
"Execute argument must be a record"
);
PyErr_SetString
(
PyExc_TypeError
,
"Execute argument must be a record"
);
return
NULL
;
return
NULL
;
}
}
params
=
((
msiobj
*
)
oparams
)
->
h
;
params
=
((
msiobj
*
)
oparams
)
->
h
;
}
}
status
=
MsiViewExecute
(
view
->
h
,
params
);
status
=
MsiViewExecute
(
view
->
h
,
params
);
if
(
status
!=
ERROR_SUCCESS
)
if
(
status
!=
ERROR_SUCCESS
)
return
msierror
(
status
);
return
msierror
(
status
);
Py_INCREF
(
Py_None
);
Py_INCREF
(
Py_None
);
return
Py_None
;
return
Py_None
;
...
@@ -708,7 +708,7 @@ view_fetch(msiobj *view, PyObject*args)
...
@@ -708,7 +708,7 @@ view_fetch(msiobj *view, PyObject*args)
MSIHANDLE
result
;
MSIHANDLE
result
;
if
((
status
=
MsiViewFetch
(
view
->
h
,
&
result
))
!=
ERROR_SUCCESS
)
if
((
status
=
MsiViewFetch
(
view
->
h
,
&
result
))
!=
ERROR_SUCCESS
)
return
msierror
(
status
);
return
msierror
(
status
);
return
record_new
(
result
);
return
record_new
(
result
);
}
}
...
@@ -721,10 +721,10 @@ view_getcolumninfo(msiobj *view, PyObject *args)
...
@@ -721,10 +721,10 @@ view_getcolumninfo(msiobj *view, PyObject *args)
MSIHANDLE
result
;
MSIHANDLE
result
;
if
(
!
PyArg_ParseTuple
(
args
,
"i:GetColumnInfo"
,
&
kind
))
if
(
!
PyArg_ParseTuple
(
args
,
"i:GetColumnInfo"
,
&
kind
))
return
NULL
;
return
NULL
;
if
((
status
=
MsiViewGetColumnInfo
(
view
->
h
,
kind
,
&
result
))
!=
ERROR_SUCCESS
)
if
((
status
=
MsiViewGetColumnInfo
(
view
->
h
,
kind
,
&
result
))
!=
ERROR_SUCCESS
)
return
msierror
(
status
);
return
msierror
(
status
);
return
record_new
(
result
);
return
record_new
(
result
);
}
}
...
@@ -737,15 +737,15 @@ view_modify(msiobj *view, PyObject *args)
...
@@ -737,15 +737,15 @@ view_modify(msiobj *view, PyObject *args)
int
status
;
int
status
;
if
(
!
PyArg_ParseTuple
(
args
,
"iO:Modify"
,
&
kind
,
&
data
))
if
(
!
PyArg_ParseTuple
(
args
,
"iO:Modify"
,
&
kind
,
&
data
))
return
NULL
;
return
NULL
;
if
(
data
->
ob_type
!=
&
record_Type
)
{
if
(
data
->
ob_type
!=
&
record_Type
)
{
PyErr_SetString
(
PyExc_TypeError
,
"Modify expects a record object"
);
PyErr_SetString
(
PyExc_TypeError
,
"Modify expects a record object"
);
return
NULL
;
return
NULL
;
}
}
if
((
status
=
MsiViewModify
(
view
->
h
,
kind
,
((
msiobj
*
)
data
)
->
h
))
!=
ERROR_SUCCESS
)
if
((
status
=
MsiViewModify
(
view
->
h
,
kind
,
((
msiobj
*
)
data
)
->
h
))
!=
ERROR_SUCCESS
)
return
msierror
(
status
);
return
msierror
(
status
);
Py_INCREF
(
Py_None
);
Py_INCREF
(
Py_None
);
return
Py_None
;
return
Py_None
;
...
@@ -757,7 +757,7 @@ view_close(msiobj *view, PyObject*args)
...
@@ -757,7 +757,7 @@ view_close(msiobj *view, PyObject*args)
int
status
;
int
status
;
if
((
status
=
MsiViewClose
(
view
->
h
))
!=
ERROR_SUCCESS
)
if
((
status
=
MsiViewClose
(
view
->
h
))
!=
ERROR_SUCCESS
)
return
msierror
(
status
);
return
msierror
(
status
);
Py_INCREF
(
Py_None
);
Py_INCREF
(
Py_None
);
return
Py_None
;
return
Py_None
;
...
@@ -765,60 +765,60 @@ view_close(msiobj *view, PyObject*args)
...
@@ -765,60 +765,60 @@ view_close(msiobj *view, PyObject*args)
static
PyMethodDef
view_methods
[]
=
{
static
PyMethodDef
view_methods
[]
=
{
{
"Execute"
,
(
PyCFunction
)
view_execute
,
METH_VARARGS
,
{
"Execute"
,
(
PyCFunction
)
view_execute
,
METH_VARARGS
,
PyDoc_STR
(
"Execute(params=None) -> None
\n
Wraps MsiViewExecute"
)},
PyDoc_STR
(
"Execute(params=None) -> None
\n
Wraps MsiViewExecute"
)},
{
"GetColumnInfo"
,
(
PyCFunction
)
view_getcolumninfo
,
METH_VARARGS
,
{
"GetColumnInfo"
,
(
PyCFunction
)
view_getcolumninfo
,
METH_VARARGS
,
PyDoc_STR
(
"GetColumnInfo() -> result
\n
Wraps MsiGetColumnInfo"
)},
PyDoc_STR
(
"GetColumnInfo() -> result
\n
Wraps MsiGetColumnInfo"
)},
{
"Fetch"
,
(
PyCFunction
)
view_fetch
,
METH_NOARGS
,
{
"Fetch"
,
(
PyCFunction
)
view_fetch
,
METH_NOARGS
,
PyDoc_STR
(
"Fetch() -> result
\n
Wraps MsiViewFetch"
)},
PyDoc_STR
(
"Fetch() -> result
\n
Wraps MsiViewFetch"
)},
{
"Modify"
,
(
PyCFunction
)
view_modify
,
METH_VARARGS
,
{
"Modify"
,
(
PyCFunction
)
view_modify
,
METH_VARARGS
,
PyDoc_STR
(
"Modify(mode,record) -> None
\n
Wraps MsiViewModify"
)},
PyDoc_STR
(
"Modify(mode,record) -> None
\n
Wraps MsiViewModify"
)},
{
"Close"
,
(
PyCFunction
)
view_close
,
METH_NOARGS
,
{
"Close"
,
(
PyCFunction
)
view_close
,
METH_NOARGS
,
PyDoc_STR
(
"Close() -> result
\n
Wraps MsiViewClose"
)},
PyDoc_STR
(
"Close() -> result
\n
Wraps MsiViewClose"
)},
{
NULL
,
NULL
}
{
NULL
,
NULL
}
};
};
static
PyTypeObject
msiview_Type
=
{
static
PyTypeObject
msiview_Type
=
{
PyVarObject_HEAD_INIT
(
NULL
,
0
)
PyVarObject_HEAD_INIT
(
NULL
,
0
)
"_msi.View"
,
/*tp_name*/
"_msi.View"
,
/*tp_name*/
sizeof
(
msiobj
),
/*tp_basicsize*/
sizeof
(
msiobj
),
/*tp_basicsize*/
0
,
/*tp_itemsize*/
0
,
/*tp_itemsize*/
/* methods */
/* methods */
(
destructor
)
msiobj_dealloc
,
/*tp_dealloc*/
(
destructor
)
msiobj_dealloc
,
/*tp_dealloc*/
0
,
/*tp_print*/
0
,
/*tp_print*/
0
,
/*tp_getattr*/
0
,
/*tp_getattr*/
0
,
/*tp_setattr*/
0
,
/*tp_setattr*/
0
,
/*tp_compare*/
0
,
/*tp_compare*/
0
,
/*tp_repr*/
0
,
/*tp_repr*/
0
,
/*tp_as_number*/
0
,
/*tp_as_number*/
0
,
/*tp_as_sequence*/
0
,
/*tp_as_sequence*/
0
,
/*tp_as_mapping*/
0
,
/*tp_as_mapping*/
0
,
/*tp_hash*/
0
,
/*tp_hash*/
0
,
/*tp_call*/
0
,
/*tp_call*/
0
,
/*tp_str*/
0
,
/*tp_str*/
PyObject_GenericGetAttr
,
/*tp_getattro*/
PyObject_GenericGetAttr
,
/*tp_getattro*/
PyObject_GenericSetAttr
,
/*tp_setattro*/
PyObject_GenericSetAttr
,
/*tp_setattro*/
0
,
/*tp_as_buffer*/
0
,
/*tp_as_buffer*/
Py_TPFLAGS_DEFAULT
,
/*tp_flags*/
Py_TPFLAGS_DEFAULT
,
/*tp_flags*/
0
,
/*tp_doc*/
0
,
/*tp_doc*/
0
,
/*tp_traverse*/
0
,
/*tp_traverse*/
0
,
/*tp_clear*/
0
,
/*tp_clear*/
0
,
/*tp_richcompare*/
0
,
/*tp_richcompare*/
0
,
/*tp_weaklistoffset*/
0
,
/*tp_weaklistoffset*/
0
,
/*tp_iter*/
0
,
/*tp_iter*/
0
,
/*tp_iternext*/
0
,
/*tp_iternext*/
view_methods
,
/*tp_methods*/
view_methods
,
/*tp_methods*/
0
,
/*tp_members*/
0
,
/*tp_members*/
0
,
/*tp_getset*/
0
,
/*tp_getset*/
0
,
/*tp_base*/
0
,
/*tp_base*/
0
,
/*tp_dict*/
0
,
/*tp_dict*/
0
,
/*tp_descr_get*/
0
,
/*tp_descr_get*/
0
,
/*tp_descr_set*/
0
,
/*tp_descr_set*/
0
,
/*tp_dictoffset*/
0
,
/*tp_dictoffset*/
0
,
/*tp_init*/
0
,
/*tp_init*/
0
,
/*tp_alloc*/
0
,
/*tp_alloc*/
0
,
/*tp_new*/
0
,
/*tp_new*/
0
,
/*tp_free*/
0
,
/*tp_free*/
0
,
/*tp_is_gc*/
0
,
/*tp_is_gc*/
};
};
/*************************** Database objects **************/
/*************************** Database objects **************/
...
@@ -832,15 +832,15 @@ msidb_openview(msiobj *msidb, PyObject *args)
...
@@ -832,15 +832,15 @@ msidb_openview(msiobj *msidb, PyObject *args)
msiobj
*
result
;
msiobj
*
result
;
if
(
!
PyArg_ParseTuple
(
args
,
"s:OpenView"
,
&
sql
))
if
(
!
PyArg_ParseTuple
(
args
,
"s:OpenView"
,
&
sql
))
return
NULL
;
return
NULL
;
if
((
status
=
MsiDatabaseOpenView
(
msidb
->
h
,
sql
,
&
hView
))
!=
ERROR_SUCCESS
)
if
((
status
=
MsiDatabaseOpenView
(
msidb
->
h
,
sql
,
&
hView
))
!=
ERROR_SUCCESS
)
return
msierror
(
status
);
return
msierror
(
status
);
result
=
PyObject_NEW
(
struct
msiobj
,
&
msiview_Type
);
result
=
PyObject_NEW
(
struct
msiobj
,
&
msiview_Type
);
if
(
!
result
)
{
if
(
!
result
)
{
MsiCloseHandle
(
hView
);
MsiCloseHandle
(
hView
);
return
NULL
;
return
NULL
;
}
}
result
->
h
=
hView
;
result
->
h
=
hView
;
...
@@ -853,7 +853,7 @@ msidb_commit(msiobj *msidb, PyObject *args)
...
@@ -853,7 +853,7 @@ msidb_commit(msiobj *msidb, PyObject *args)
int
status
;
int
status
;
if
((
status
=
MsiDatabaseCommit
(
msidb
->
h
))
!=
ERROR_SUCCESS
)
if
((
status
=
MsiDatabaseCommit
(
msidb
->
h
))
!=
ERROR_SUCCESS
)
return
msierror
(
status
);
return
msierror
(
status
);
Py_INCREF
(
Py_None
);
Py_INCREF
(
Py_None
);
return
Py_None
;
return
Py_None
;
...
@@ -868,16 +868,16 @@ msidb_getsummaryinformation(msiobj *db, PyObject *args)
...
@@ -868,16 +868,16 @@ msidb_getsummaryinformation(msiobj *db, PyObject *args)
msiobj
*
oresult
;
msiobj
*
oresult
;
if
(
!
PyArg_ParseTuple
(
args
,
"i:GetSummaryInformation"
,
&
count
))
if
(
!
PyArg_ParseTuple
(
args
,
"i:GetSummaryInformation"
,
&
count
))
return
NULL
;
return
NULL
;
status
=
MsiGetSummaryInformation
(
db
->
h
,
NULL
,
count
,
&
result
);
status
=
MsiGetSummaryInformation
(
db
->
h
,
NULL
,
count
,
&
result
);
if
(
status
!=
ERROR_SUCCESS
)
if
(
status
!=
ERROR_SUCCESS
)
return
msierror
(
status
);
return
msierror
(
status
);
oresult
=
PyObject_NEW
(
struct
msiobj
,
&
summary_Type
);
oresult
=
PyObject_NEW
(
struct
msiobj
,
&
summary_Type
);
if
(
!
result
)
{
if
(
!
result
)
{
MsiCloseHandle
(
result
);
MsiCloseHandle
(
result
);
return
NULL
;
return
NULL
;
}
}
oresult
->
h
=
result
;
oresult
->
h
=
result
;
...
@@ -886,56 +886,56 @@ msidb_getsummaryinformation(msiobj *db, PyObject *args)
...
@@ -886,56 +886,56 @@ msidb_getsummaryinformation(msiobj *db, PyObject *args)
static
PyMethodDef
db_methods
[]
=
{
static
PyMethodDef
db_methods
[]
=
{
{
"OpenView"
,
(
PyCFunction
)
msidb_openview
,
METH_VARARGS
,
{
"OpenView"
,
(
PyCFunction
)
msidb_openview
,
METH_VARARGS
,
PyDoc_STR
(
"OpenView(sql) -> viewobj
\n
Wraps MsiDatabaseOpenView"
)},
PyDoc_STR
(
"OpenView(sql) -> viewobj
\n
Wraps MsiDatabaseOpenView"
)},
{
"Commit"
,
(
PyCFunction
)
msidb_commit
,
METH_NOARGS
,
{
"Commit"
,
(
PyCFunction
)
msidb_commit
,
METH_NOARGS
,
PyDoc_STR
(
"Commit() -> None
\n
Wraps MsiDatabaseCommit"
)},
PyDoc_STR
(
"Commit() -> None
\n
Wraps MsiDatabaseCommit"
)},
{
"GetSummaryInformation"
,
(
PyCFunction
)
msidb_getsummaryinformation
,
METH_VARARGS
,
{
"GetSummaryInformation"
,
(
PyCFunction
)
msidb_getsummaryinformation
,
METH_VARARGS
,
PyDoc_STR
(
"GetSummaryInformation(updateCount) -> viewobj
\n
Wraps MsiGetSummaryInformation"
)},
PyDoc_STR
(
"GetSummaryInformation(updateCount) -> viewobj
\n
Wraps MsiGetSummaryInformation"
)},
{
NULL
,
NULL
}
{
NULL
,
NULL
}
};
};
static
PyTypeObject
msidb_Type
=
{
static
PyTypeObject
msidb_Type
=
{
PyVarObject_HEAD_INIT
(
NULL
,
0
)
PyVarObject_HEAD_INIT
(
NULL
,
0
)
"_msi.Database"
,
/*tp_name*/
"_msi.Database"
,
/*tp_name*/
sizeof
(
msiobj
),
/*tp_basicsize*/
sizeof
(
msiobj
),
/*tp_basicsize*/
0
,
/*tp_itemsize*/
0
,
/*tp_itemsize*/
/* methods */
/* methods */
(
destructor
)
msiobj_dealloc
,
/*tp_dealloc*/
(
destructor
)
msiobj_dealloc
,
/*tp_dealloc*/
0
,
/*tp_print*/
0
,
/*tp_print*/
0
,
/*tp_getattr*/
0
,
/*tp_getattr*/
0
,
/*tp_setattr*/
0
,
/*tp_setattr*/
0
,
/*tp_compare*/
0
,
/*tp_compare*/
0
,
/*tp_repr*/
0
,
/*tp_repr*/
0
,
/*tp_as_number*/
0
,
/*tp_as_number*/
0
,
/*tp_as_sequence*/
0
,
/*tp_as_sequence*/
0
,
/*tp_as_mapping*/
0
,
/*tp_as_mapping*/
0
,
/*tp_hash*/
0
,
/*tp_hash*/
0
,
/*tp_call*/
0
,
/*tp_call*/
0
,
/*tp_str*/
0
,
/*tp_str*/
PyObject_GenericGetAttr
,
/*tp_getattro*/
PyObject_GenericGetAttr
,
/*tp_getattro*/
PyObject_GenericSetAttr
,
/*tp_setattro*/
PyObject_GenericSetAttr
,
/*tp_setattro*/
0
,
/*tp_as_buffer*/
0
,
/*tp_as_buffer*/
Py_TPFLAGS_DEFAULT
,
/*tp_flags*/
Py_TPFLAGS_DEFAULT
,
/*tp_flags*/
0
,
/*tp_doc*/
0
,
/*tp_doc*/
0
,
/*tp_traverse*/
0
,
/*tp_traverse*/
0
,
/*tp_clear*/
0
,
/*tp_clear*/
0
,
/*tp_richcompare*/
0
,
/*tp_richcompare*/
0
,
/*tp_weaklistoffset*/
0
,
/*tp_weaklistoffset*/
0
,
/*tp_iter*/
0
,
/*tp_iter*/
0
,
/*tp_iternext*/
0
,
/*tp_iternext*/
db_methods
,
/*tp_methods*/
db_methods
,
/*tp_methods*/
0
,
/*tp_members*/
0
,
/*tp_members*/
0
,
/*tp_getset*/
0
,
/*tp_getset*/
0
,
/*tp_base*/
0
,
/*tp_base*/
0
,
/*tp_dict*/
0
,
/*tp_dict*/
0
,
/*tp_descr_get*/
0
,
/*tp_descr_get*/
0
,
/*tp_descr_set*/
0
,
/*tp_descr_set*/
0
,
/*tp_dictoffset*/
0
,
/*tp_dictoffset*/
0
,
/*tp_init*/
0
,
/*tp_init*/
0
,
/*tp_alloc*/
0
,
/*tp_alloc*/
0
,
/*tp_new*/
0
,
/*tp_new*/
0
,
/*tp_free*/
0
,
/*tp_free*/
0
,
/*tp_is_gc*/
0
,
/*tp_is_gc*/
};
};
static
PyObject
*
msiopendb
(
PyObject
*
obj
,
PyObject
*
args
)
static
PyObject
*
msiopendb
(
PyObject
*
obj
,
PyObject
*
args
)
...
@@ -947,16 +947,16 @@ static PyObject* msiopendb(PyObject *obj, PyObject *args)
...
@@ -947,16 +947,16 @@ static PyObject* msiopendb(PyObject *obj, PyObject *args)
msiobj
*
result
;
msiobj
*
result
;
if
(
!
PyArg_ParseTuple
(
args
,
"si:MSIOpenDatabase"
,
&
path
,
&
persist
))
if
(
!
PyArg_ParseTuple
(
args
,
"si:MSIOpenDatabase"
,
&
path
,
&
persist
))
return
NULL
;
return
NULL
;
status
=
MsiOpenDatabase
(
path
,
(
LPCSTR
)
persist
,
&
h
);
status
=
MsiOpenDatabase
(
path
,
(
LPCSTR
)
persist
,
&
h
);
if
(
status
!=
ERROR_SUCCESS
)
if
(
status
!=
ERROR_SUCCESS
)
return
msierror
(
status
);
return
msierror
(
status
);
result
=
PyObject_NEW
(
struct
msiobj
,
&
msidb_Type
);
result
=
PyObject_NEW
(
struct
msiobj
,
&
msidb_Type
);
if
(
!
result
)
{
if
(
!
result
)
{
MsiCloseHandle
(
h
);
MsiCloseHandle
(
h
);
return
NULL
;
return
NULL
;
}
}
result
->
h
=
h
;
result
->
h
=
h
;
return
(
PyObject
*
)
result
;
return
(
PyObject
*
)
result
;
...
@@ -969,26 +969,26 @@ createrecord(PyObject *o, PyObject *args)
...
@@ -969,26 +969,26 @@ createrecord(PyObject *o, PyObject *args)
MSIHANDLE
h
;
MSIHANDLE
h
;
if
(
!
PyArg_ParseTuple
(
args
,
"i:CreateRecord"
,
&
count
))
if
(
!
PyArg_ParseTuple
(
args
,
"i:CreateRecord"
,
&
count
))
return
NULL
;
return
NULL
;
h
=
MsiCreateRecord
(
count
);
h
=
MsiCreateRecord
(
count
);
if
(
h
==
0
)
if
(
h
==
0
)
return
msierror
(
0
);
return
msierror
(
0
);
return
record_new
(
h
);
return
record_new
(
h
);
}
}
static
PyMethodDef
msi_methods
[]
=
{
static
PyMethodDef
msi_methods
[]
=
{
{
"UuidCreate"
,
(
PyCFunction
)
uuidcreate
,
METH_NOARGS
,
{
"UuidCreate"
,
(
PyCFunction
)
uuidcreate
,
METH_NOARGS
,
PyDoc_STR
(
"UuidCreate() -> string"
)},
PyDoc_STR
(
"UuidCreate() -> string"
)},
{
"FCICreate"
,
(
PyCFunction
)
fcicreate
,
METH_VARARGS
,
{
"FCICreate"
,
(
PyCFunction
)
fcicreate
,
METH_VARARGS
,
PyDoc_STR
(
"fcicreate(cabname,files) -> None"
)},
PyDoc_STR
(
"fcicreate(cabname,files) -> None"
)},
{
"OpenDatabase"
,
(
PyCFunction
)
msiopendb
,
METH_VARARGS
,
{
"OpenDatabase"
,
(
PyCFunction
)
msiopendb
,
METH_VARARGS
,
PyDoc_STR
(
"OpenDatabase(name, flags) -> dbobj
\n
Wraps MsiOpenDatabase"
)},
PyDoc_STR
(
"OpenDatabase(name, flags) -> dbobj
\n
Wraps MsiOpenDatabase"
)},
{
"CreateRecord"
,
(
PyCFunction
)
createrecord
,
METH_VARARGS
,
{
"CreateRecord"
,
(
PyCFunction
)
createrecord
,
METH_VARARGS
,
PyDoc_STR
(
"OpenDatabase(name, flags) -> dbobj
\n
Wraps MsiCreateRecord"
)},
PyDoc_STR
(
"OpenDatabase(name, flags) -> dbobj
\n
Wraps MsiCreateRecord"
)},
{
NULL
,
NULL
}
/* sentinel */
{
NULL
,
NULL
}
/* sentinel */
};
};
static
char
msi_doc
[]
=
"Documentation"
;
static
char
msi_doc
[]
=
"Documentation"
;
...
@@ -1000,7 +1000,7 @@ init_msi(void)
...
@@ -1000,7 +1000,7 @@ init_msi(void)
m
=
Py_InitModule3
(
"_msi"
,
msi_methods
,
msi_doc
);
m
=
Py_InitModule3
(
"_msi"
,
msi_methods
,
msi_doc
);
if
(
m
==
NULL
)
if
(
m
==
NULL
)
return
;
return
;
PyModule_AddIntConstant
(
m
,
"MSIDBOPEN_CREATEDIRECT"
,
(
int
)
MSIDBOPEN_CREATEDIRECT
);
PyModule_AddIntConstant
(
m
,
"MSIDBOPEN_CREATEDIRECT"
,
(
int
)
MSIDBOPEN_CREATEDIRECT
);
PyModule_AddIntConstant
(
m
,
"MSIDBOPEN_CREATE"
,
(
int
)
MSIDBOPEN_CREATE
);
PyModule_AddIntConstant
(
m
,
"MSIDBOPEN_CREATE"
,
(
int
)
MSIDBOPEN_CREATE
);
...
@@ -1046,6 +1046,6 @@ init_msi(void)
...
@@ -1046,6 +1046,6 @@ init_msi(void)
MSIError
=
PyErr_NewException
(
"_msi.MSIError"
,
NULL
,
NULL
);
MSIError
=
PyErr_NewException
(
"_msi.MSIError"
,
NULL
,
NULL
);
if
(
!
MSIError
)
if
(
!
MSIError
)
return
;
return
;
PyModule_AddObject
(
m
,
"MSIError"
,
MSIError
);
PyModule_AddObject
(
m
,
"MSIError"
,
MSIError
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment