📄 setupapi.inc
字号:
'*************************************************************************
SUB UIPopAll STATIC
IF FKillNDialogs(65535) = 0 THEN
'$ifdef DEBUG
StfApiErr saeFail, "UIPopAll", ""
'$endif ''DEBUG
ERROR STFERR
END IF
END SUB
'*************************************************************************
FUNCTION GetSymbolValue(szSymbol$) STATIC AS STRING
'$ifdef DEBUG
if szSymbol$ = "" then
BadArgErr 1, "GetSymbolValue", szSymbol$
end if
'$endif ''DEBUG
szValue$ = string$(cbSymValMax,32)
Length% = CbGetSymbolValue(szSymbol$, szValue$, cbSymValMax)
GetSymbolValue = szValue$
IF Length% >= cbSymValMax THEN
res% = DoMsgBox("Buffer Overflow", "MS-Setup Error", MB_ICONHAND+MB_OK)
ERROR STFERR
END IF
IF szSymbol$ = "" THEN
ERROR STFERR
END IF
szValue$ = ""
END FUNCTION
'*************************************************************************
FUNCTION GetListLength(szSymbol$) STATIC AS INTEGER
'$ifdef DEBUG
if szSymbol$ = "" then
BadArgErr 1, "GetListLength", szSymbol$
end if
'$endif ''DEBUG
GetListLength = UsGetListLength(szSymbol$)
IF szSymbol$ = "" THEN
ERROR STFERR
END IF
END FUNCTION
'*************************************************************************
FUNCTION GetListItem(szListSymbol$, nItem%) STATIC AS STRING
'$ifdef DEBUG
if szListSymbol$ = "" then
BadArgErr 1, "GetListItem", szListSymbol$+", "+STR$(nItem%)
end if
if nItem% <= 0 or nItem% > GetListLength(szListSymbol$) then
BadArgErr 2, "GetListItem", szListSymbol$+", "+STR$(nItem%)
end if
'$endif ''DEBUG
szListItem$ = string$(cbSymValMax,32)
Length% = CbGetListItem(szListSymbol$, nItem%, szListItem$, cbSymValMax)
GetListItem = szListItem$
IF Length% >= cbSymValMax THEN
res% = DoMsgBox("Buffer Overflow", "MS-Setup Error", MB_ICONHAND+MB_OK)
ERROR STFERR
END IF
IF szListSymbol$ = "" THEN
ERROR STFERR
END IF
if nItem% <= 0 or nItem% > GetListLength(szListSymbol$) then
ERROR STFERR
end if
szListItem$ = ""
END FUNCTION
'*************************************************************************
SUB AddListItem(szSymbol$, szItem$) STATIC
'$ifdef DEBUG
if szSymbol$ = "" then
BadArgErr 1, "AddListItem", szSymbol$+", "+szItem$
end if
'$endif ''DEBUG
IF FAddListItem(szSymbol$, szItem$) = 0 THEN
'$ifdef DEBUG
StfApiErr saeFail, "AddListItem", szSymbol$+", "+szItem$
'$endif ''DEBUG
ERROR STFERR
END IF
END SUB
'*************************************************************************
SUB ReplaceListItem(szSymbol$, n%, szItem$) STATIC
'$ifdef DEBUG
if szSymbol$ = "" then
nArg% = 1
elseif (n% <= 0) OR (n% > GetListLength(szSymbol$)) then
nArg% = 2
else
nArg% = 0
end if
if nArg% > 0 then
BadArgErr nArg%, "ReplaceListItem", szSymbol$+", "+STR$(n%)+", "+szItem$
end if
'$endif ''DEBUG
IF FReplaceListItem(szSymbol$, n%, szItem$) = 0 THEN
'$ifdef DEBUG
StfApiErr saeFail, "ReplaceListItem", szSymbol$+", "+STR$(n%)+", "+szItem$
'$endif ''DEBUG
ERROR STFERR
END IF
END SUB
'**************************************************************************
SUB MakeListFromSectionKeys(szSymbol$, szSect$) STATIC
'$ifdef DEBUG
if szSymbol$ = "" then
n% = 1
elseif FValidInfSect(szSect$) = 0 then
n% = 2
else
n% = 0
end if
if n% > 0 then
BadArgErr n%, "MakeListFromSectionKeys", szSymbol$+", "+szSect$
end if
'$endif ''DEBUG
IF FSetSymbolToListOfInfKeys(szSymbol$, szSect$, 1) = 0 THEN
'$ifdef DEBUG
StfApiErr saeFail, "MakeListFromSectionKeys", szSymbol$+", "+szSect$
'$endif ''DEBUG
ERROR STFERR
END IF
END SUB
'*************************************************************************
SUB SetSymbolValue(szSymbol$, szValue$) STATIC
'$ifdef DEBUG
if szSymbol$ = "" then
BadArgErr 1, "SetSymbolValue", szSymbol$+", "+szValue$
end if
'$endif ''DEBUG
IF FSetSymbolValue(szSymbol$, szValue$) = 0 THEN
'$ifdef DEBUG
StfApiErr saeFail, "SetSymbolValue", szSymbol$+", "+szValue$
'$endif ''DEBUG
ERROR STFERR
END IF
END SUB
'*************************************************************************
SUB RemoveSymbol(szSym$) STATIC
'$ifdef DEBUG
if szSym$ = "" then
BadArgErr 1, "RemoveSymbol", szSym$
end if
'$endif ''DEBUG
IF FRemoveSymbol(szSym$) = 0 THEN
'$ifdef DEBUG
StfApiErr saeFail, "RemoveSymbol", szSym$
'$endif ''DEBUG
ERROR STFERR
END IF
END SUB
'*************************************************************************
FUNCTION ShowWaitCursor STATIC AS INTEGER
ShowWaitCursor = HShowWaitCursor
END FUNCTION
'*************************************************************************
SUB RestoreCursor (hPrev%) STATIC
i% = FRestoreCursor(hPrev%)
IF i% = 0 THEN
'$ifdef DEBUG
StfApiErr saeFail, "RestoreCursor", ""
'$endif ''DEBUG
ERROR STFERR
END IF
END SUB
'*************************************************************************
FUNCTION SetBeepingMode (mode%) STATIC AS INTEGER
SetBeepingMode = FSetBeepingMode(mode%)
END FUNCTION
'*************************************************************************
FUNCTION SetSilentMode (mode%) STATIC AS INTEGER
SetSilentMode = FSetSilent(mode%)
END FUNCTION
'*************************************************************************
FUNCTION GetSectionKeyDate (szSect$, szKey$) STATIC AS STRING
'$ifdef DEBUG
if FValidInfSect(szSect$) = 0 then
n% = 1
elseif szKey$ = "" then
n% = 2
else
n% = 0
end if
if n% > 0 then
BadArgErr n%, "GetSectionKeyDate", szSect$+", "+szKey$
end if
'$endif ''DEBUG
szBuf$ = string$(128, 32)
Length% = CbGetInfSectionKeyField(szSect$, szKey$, 5, szBuf$, 128)
IF Length% >= 128 THEN
res% = DoMsgBox("Buffer Overflow", "MS-Setup Error", MB_ICONHAND+MB_OK)
ERROR STFERR
END IF
IF Length% = -1 THEN
'$ifdef DEBUG
StfApiErr saeFail, "GetSectionKeyDate", szSect$+", "+szKey$
'$endif ''DEBUG
ERROR STFERR
END IF
GetSectionKeyDate = szBuf$
szBuf$ = ""
END FUNCTION
'*************************************************************************
FUNCTION GetSectionKeyFilename (szSect$, szKey$) STATIC AS STRING
'$ifdef DEBUG
if FValidInfSect(szSect$) = 0 then
n% = 1
elseif szKey$ = "" then
n% = 2
else
n% = 0
end if
if n% > 0 then
BadArgErr n%, "GetSectionKeyFilename", szSect$+", "+szKey$
end if
'$endif ''DEBUG
szBuf$ = string$(128, 32)
Length% = CbGetInfSectionKeyField(szSect$, szKey$, 1, szBuf$, 128)
IF Length% >= 128 THEN
res% = DoMsgBox("Buffer Overflow", "MS-Setup Error", MB_ICONHAND+MB_OK)
ERROR STFERR
END IF
IF Length% = -1 THEN
'$ifdef DEBUG
StfApiErr saeFail, "GetSectionKeyFilename", szSect$+", "+szKey$
'$endif ''DEBUG
ERROR STFERR
END IF
GetSectionKeyFilename = szBuf$
szBuf$ = ""
END FUNCTION
'*************************************************************************
FUNCTION GetSectionKeySize (szSect$, szKey$) STATIC AS LONG
'$ifdef DEBUG
if FValidInfSect(szSect$) = 0 then
n% = 1
elseif szKey$ = "" then
n% = 2
else
n% = 0
end if
if n% > 0 then
BadArgErr n%, "GetSectionKeySize", szSect$+", "+szKey$
end if
'$endif ''DEBUG
szBuf$ = string$(128, 32)
Length% = CbGetInfSectionKeyField(szSect$, szKey$, 15, szBuf$, 128)
IF Length% >= 128 THEN
res% = DoMsgBox("Buffer Overflow", "MS-Setup Error", MB_ICONHAND+MB_OK)
ERROR STFERR
END IF
IF Length% = -1 THEN
'$ifdef DEBUG
StfApiErr saeFail, "GetSectionKeySize", szSect$+", "+szKey$
'$endif ''DEBUG
ERROR STFERR
END IF
GetSectionKeySize = VAL(szBuf$)
szBuf$ = ""
END FUNCTION
'*************************************************************************
FUNCTION GetSectionKeyVersion (szSect$, szKey$) STATIC AS STRING
'$ifdef DEBUG
if FValidInfSect(szSect$) = 0 then
n% = 1
elseif szKey$ = "" then
n% = 2
else
n% = 0
end if
if n% > 0 then
BadArgErr n%, "GetSectionKeyVersion", szSect$+", "+szKey$
end if
'$endif ''DEBUG
szBuf$ = string$(128, 32)
Length% = CbGetInfSectionKeyField(szSect$, szKey$, 19, szBuf$, 128)
IF Length% >= 128 THEN
res% = DoMsgBox("Buffer Overflow", "MS-Setup Error", MB_ICONHAND+MB_OK)
ERROR STFERR
END IF
IF Length% = -1 THEN
'$ifdef DEBUG
StfApiErr saeFail, "GetSectionKeyVersion", szSect$+", "+szKey$
'$endif ''DEBUG
ERROR STFERR
END IF
GetSectionKeyVersion = szBuf$
szBuf$ = ""
END FUNCTION
'*************************************************************************
SUB MakeListFromSectionDate (szSym$, szSect$) STATIC
'$ifdef DEBUG
if szSym$ = "" then
n% = 1
elseif FValidInfSect(szSect$) = 0 then
n% = 2
else
n% = 0
end if
if n% > 0 then
BadArgErr n%, "MakeListFromSectionDate", szSym$+", "+szSect$
end if
'$endif ''DEBUG
IF FMakeListInfSectionField(szSym$, szSect$, 5) = 0 THEN
'$ifdef DEBUG
StfApiErr saeFail, "MakeListFromSectionDate", szSym$+", "+szSect$
'$endif ''DEBUG
ERROR STFERR
END IF
END SUB
'*************************************************************************
SUB MakeListFromSectionFilename (szSym$, szSect$) STATIC
'$ifdef DEBUG
if szSym$ = "" then
n% = 1
elseif FValidInfSect(szSect$) = 0 then
n% = 2
else
n% = 0
end if
if n% > 0 then
BadArgErr n%, "MakeListFromSectionFilename", szSym$+", "+szSect$
end if
'$endif ''DEBUG
IF FMakeListInfSectionField(szSym$, szSect$, 1) = 0 THEN
'$ifdef DEBUG
StfApiErr saeFail, "MakeListFromSectionFilename", szSym$+", "+szSect$
'$endif ''DEBUG
ERROR STFERR
END IF
END SUB
'*************************************************************************
SUB MakeListFromSectionSize (szSym$, szSect$) STATIC
'$ifdef DEBUG
if szSym$ = "" then
n% = 1
elseif FValidInfSect(szSect$) = 0 then
n% = 2
else
n% = 0
end if
if n% > 0 then
BadArgErr n%, "MakeListFromSectionSize", szSym$+", "+szSect$
end if
'$endif ''DEBUG
IF FMakeListInfSectionField(szSym$, szSect$, 15) = 0 THEN
'$ifdef DEBUG
StfApiErr saeFail, "MakeListFromSectionSize", szSym$+", "+szSect$
'$endif ''DEBUG
ERROR STFERR
END IF
END SUB
'*************************************************************************
SUB MakeListFromSectionVersion (szSym$, szSect$) STATIC
'$ifdef DEBUG
if szSym$ = "" then
n% = 1
elseif FValidInfSect(szSect$) = 0 then
n% = 2
else
n% = 0
end if
if n% > 0 then
BadArgErr n%, "MakeListFromSectionVersion", szSym$+", "+szSect$
end if
'$endif ''DEBUG
IF FMakeListInfSectionField(szSym$, szSect$, 19) = 0 THEN
'$ifdef DEBUG
StfApiErr saeFail, "MakeListFromSectionVersion", szSym$+", "+szSect$
'$endif ''DEBUG
ERROR STFERR
END IF
END SUB
'*************************************************************************
SUB InitInstall STATIC
IF hSetup > 0 THEN
'$ifdef DEBUG
StfApiErr saeInit, "InitInstall", ""
'$endif ''DEBUG
ELSEIF FInitializeInstall(HinstFrame(), HwndFrame()) = 0 THEN
'$ifdef DEBUG
StfApiErr saeFail, "InitInstall", ""
'$endif ''DEBUG
END
END IF
END SUB
'*************************************************************************
SUB CreateDir (szDir$, cmo%) STATIC
'$ifdef DEBUG
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -