Perform build and magnum tuning
Building o//third_party/python now takes 5 seconds on my PC This change works towards modifying Python to use runtime dispatching when appropriate. For example, when loading the magnums in the socket module, it's a good idea to check if the magnum is zero, because that means the local system platform doesn't support it.
16
third_party/python/PC/WinMain.c
vendored
|
@ -1,16 +0,0 @@
|
|||
/* Minimal main program -- everything is loaded from the library. */
|
||||
|
||||
#include "Python.h"
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
|
||||
int WINAPI wWinMain(
|
||||
HINSTANCE hInstance, /* handle to current instance */
|
||||
HINSTANCE hPrevInstance, /* handle to previous instance */
|
||||
LPWSTR lpCmdLine, /* pointer to command line */
|
||||
int nCmdShow /* show state of window */
|
||||
)
|
||||
{
|
||||
return Py_Main(__argc, __wargv);
|
||||
}
|
259
third_party/python/PC/_findvs.cpp
vendored
|
@ -1,259 +0,0 @@
|
|||
//
|
||||
// Helper library for location Visual Studio installations
|
||||
// using the COM-based query API.
|
||||
//
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// Licensed to PSF under a contributor agreement
|
||||
//
|
||||
|
||||
// Version history
|
||||
// 2017-05: Initial contribution (Steve Dower)
|
||||
|
||||
#include <Windows.h>
|
||||
#include <Strsafe.h>
|
||||
#include "external\include\Setup.Configuration.h"
|
||||
|
||||
#include <Python.h>
|
||||
|
||||
static PyObject *error_from_hr(HRESULT hr)
|
||||
{
|
||||
if (FAILED(hr))
|
||||
PyErr_Format(PyExc_OSError, "Error %08x", hr);
|
||||
assert(PyErr_Occurred());
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
static PyObject *get_install_name(ISetupInstance2 *inst)
|
||||
{
|
||||
HRESULT hr;
|
||||
BSTR name;
|
||||
PyObject *str = nullptr;
|
||||
if (FAILED(hr = inst->GetDisplayName(LOCALE_USER_DEFAULT, &name)))
|
||||
goto error;
|
||||
str = PyUnicode_FromWideChar(name, SysStringLen(name));
|
||||
SysFreeString(name);
|
||||
return str;
|
||||
error:
|
||||
|
||||
return error_from_hr(hr);
|
||||
}
|
||||
|
||||
static PyObject *get_install_version(ISetupInstance *inst)
|
||||
{
|
||||
HRESULT hr;
|
||||
BSTR ver;
|
||||
PyObject *str = nullptr;
|
||||
if (FAILED(hr = inst->GetInstallationVersion(&ver)))
|
||||
goto error;
|
||||
str = PyUnicode_FromWideChar(ver, SysStringLen(ver));
|
||||
SysFreeString(ver);
|
||||
return str;
|
||||
error:
|
||||
|
||||
return error_from_hr(hr);
|
||||
}
|
||||
|
||||
static PyObject *get_install_path(ISetupInstance *inst)
|
||||
{
|
||||
HRESULT hr;
|
||||
BSTR path;
|
||||
PyObject *str = nullptr;
|
||||
if (FAILED(hr = inst->GetInstallationPath(&path)))
|
||||
goto error;
|
||||
str = PyUnicode_FromWideChar(path, SysStringLen(path));
|
||||
SysFreeString(path);
|
||||
return str;
|
||||
error:
|
||||
|
||||
return error_from_hr(hr);
|
||||
}
|
||||
|
||||
static PyObject *get_installed_packages(ISetupInstance2 *inst)
|
||||
{
|
||||
HRESULT hr;
|
||||
PyObject *res = nullptr;
|
||||
LPSAFEARRAY sa_packages = nullptr;
|
||||
LONG ub = 0;
|
||||
IUnknown **packages = nullptr;
|
||||
PyObject *str = nullptr;
|
||||
|
||||
if (FAILED(hr = inst->GetPackages(&sa_packages)) ||
|
||||
FAILED(hr = SafeArrayAccessData(sa_packages, (void**)&packages)) ||
|
||||
FAILED(SafeArrayGetUBound(sa_packages, 1, &ub)) ||
|
||||
!(res = PyList_New(0)))
|
||||
goto error;
|
||||
|
||||
for (LONG i = 0; i < ub; ++i) {
|
||||
ISetupPackageReference *package = nullptr;
|
||||
BSTR id = nullptr;
|
||||
PyObject *str = nullptr;
|
||||
|
||||
if (FAILED(hr = packages[i]->QueryInterface(&package)) ||
|
||||
FAILED(hr = package->GetId(&id)))
|
||||
goto iter_error;
|
||||
|
||||
str = PyUnicode_FromWideChar(id, SysStringLen(id));
|
||||
SysFreeString(id);
|
||||
|
||||
if (!str || PyList_Append(res, str) < 0)
|
||||
goto iter_error;
|
||||
|
||||
Py_CLEAR(str);
|
||||
package->Release();
|
||||
continue;
|
||||
|
||||
iter_error:
|
||||
if (package) package->Release();
|
||||
Py_XDECREF(str);
|
||||
|
||||
goto error;
|
||||
}
|
||||
|
||||
SafeArrayUnaccessData(sa_packages);
|
||||
SafeArrayDestroy(sa_packages);
|
||||
|
||||
return res;
|
||||
error:
|
||||
if (sa_packages && packages) SafeArrayUnaccessData(sa_packages);
|
||||
if (sa_packages) SafeArrayDestroy(sa_packages);
|
||||
Py_XDECREF(res);
|
||||
|
||||
return error_from_hr(hr);
|
||||
}
|
||||
|
||||
static PyObject *find_all_instances()
|
||||
{
|
||||
ISetupConfiguration *sc = nullptr;
|
||||
ISetupConfiguration2 *sc2 = nullptr;
|
||||
IEnumSetupInstances *enm = nullptr;
|
||||
ISetupInstance *inst = nullptr;
|
||||
ISetupInstance2 *inst2 = nullptr;
|
||||
PyObject *res = nullptr;
|
||||
ULONG fetched;
|
||||
HRESULT hr;
|
||||
|
||||
if (!(res = PyList_New(0)))
|
||||
goto error;
|
||||
|
||||
if (FAILED(hr = CoCreateInstance(
|
||||
__uuidof(SetupConfiguration),
|
||||
NULL,
|
||||
CLSCTX_INPROC_SERVER,
|
||||
__uuidof(ISetupConfiguration),
|
||||
(LPVOID*)&sc
|
||||
)) && hr != REGDB_E_CLASSNOTREG)
|
||||
goto error;
|
||||
|
||||
// If the class is not registered, there are no VS instances installed
|
||||
if (hr == REGDB_E_CLASSNOTREG)
|
||||
return res;
|
||||
|
||||
if (FAILED(hr = sc->QueryInterface(&sc2)) ||
|
||||
FAILED(hr = sc2->EnumAllInstances(&enm)))
|
||||
goto error;
|
||||
|
||||
while (SUCCEEDED(enm->Next(1, &inst, &fetched)) && fetched) {
|
||||
PyObject *name = nullptr;
|
||||
PyObject *version = nullptr;
|
||||
PyObject *path = nullptr;
|
||||
PyObject *packages = nullptr;
|
||||
PyObject *tuple = nullptr;
|
||||
|
||||
if (FAILED(hr = inst->QueryInterface(&inst2)) ||
|
||||
!(name = get_install_name(inst2)) ||
|
||||
!(version = get_install_version(inst)) ||
|
||||
!(path = get_install_path(inst)) ||
|
||||
!(packages = get_installed_packages(inst2)) ||
|
||||
!(tuple = PyTuple_Pack(4, name, version, path, packages)) ||
|
||||
PyList_Append(res, tuple) < 0)
|
||||
goto iter_error;
|
||||
|
||||
Py_DECREF(tuple);
|
||||
Py_DECREF(packages);
|
||||
Py_DECREF(path);
|
||||
Py_DECREF(version);
|
||||
Py_DECREF(name);
|
||||
continue;
|
||||
iter_error:
|
||||
if (inst2) inst2->Release();
|
||||
Py_XDECREF(tuple);
|
||||
Py_XDECREF(packages);
|
||||
Py_XDECREF(path);
|
||||
Py_XDECREF(version);
|
||||
Py_XDECREF(name);
|
||||
goto error;
|
||||
}
|
||||
|
||||
enm->Release();
|
||||
sc2->Release();
|
||||
sc->Release();
|
||||
return res;
|
||||
|
||||
error:
|
||||
if (enm) enm->Release();
|
||||
if (sc2) sc2->Release();
|
||||
if (sc) sc->Release();
|
||||
Py_XDECREF(res);
|
||||
|
||||
return error_from_hr(hr);
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(findvs_findall_doc, "findall()\
|
||||
\
|
||||
Finds all installed versions of Visual Studio.\
|
||||
\
|
||||
This function will initialize COM temporarily. To avoid impact on other parts\
|
||||
of your application, use a new thread to make this call.");
|
||||
|
||||
static PyObject *findvs_findall(PyObject *self, PyObject *args, PyObject *kwargs)
|
||||
{
|
||||
HRESULT hr = CoInitializeEx(nullptr, COINIT_MULTITHREADED);
|
||||
if (hr == RPC_E_CHANGED_MODE)
|
||||
hr = CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED);
|
||||
if (FAILED(hr))
|
||||
return error_from_hr(hr);
|
||||
PyObject *res = find_all_instances();
|
||||
CoUninitialize();
|
||||
return res;
|
||||
}
|
||||
|
||||
// List of functions to add to findvs in exec_findvs().
|
||||
static PyMethodDef findvs_functions[] = {
|
||||
{ "findall", (PyCFunction)findvs_findall, METH_VARARGS | METH_KEYWORDS, findvs_findall_doc },
|
||||
{ NULL, NULL, 0, NULL }
|
||||
};
|
||||
|
||||
// Initialize findvs. May be called multiple times, so avoid
|
||||
// using static state.
|
||||
static int exec_findvs(PyObject *module)
|
||||
{
|
||||
PyModule_AddFunctions(module, findvs_functions);
|
||||
|
||||
return 0; // success
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(findvs_doc, "The _distutils_findvs helper module");
|
||||
|
||||
static PyModuleDef_Slot findvs_slots[] = {
|
||||
{ Py_mod_exec, exec_findvs },
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
static PyModuleDef findvs_def = {
|
||||
PyModuleDef_HEAD_INIT,
|
||||
"_distutils_findvs",
|
||||
findvs_doc,
|
||||
0, // m_size
|
||||
NULL, // m_methods
|
||||
findvs_slots,
|
||||
NULL, // m_traverse
|
||||
NULL, // m_clear
|
||||
NULL, // m_free
|
||||
};
|
||||
|
||||
extern "C" {
|
||||
PyMODINIT_FUNC PyInit__distutils_findvs(void)
|
||||
{
|
||||
return PyModuleDef_Init(&findvs_def);
|
||||
}
|
||||
}
|
1120
third_party/python/PC/_msi.c
vendored
131
third_party/python/PC/_testconsole.c
vendored
|
@ -1,131 +0,0 @@
|
|||
|
||||
/* Testing module for multi-phase initialization of extension modules (PEP 489)
|
||||
*/
|
||||
|
||||
#include "Python.h"
|
||||
|
||||
#ifdef MS_WINDOWS
|
||||
|
||||
#include "..\modules\_io\_iomodule.h"
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
/* The full definition is in iomodule. We reproduce
|
||||
enough here to get the handle, which is all we want. */
|
||||
typedef struct {
|
||||
PyObject_HEAD
|
||||
HANDLE handle;
|
||||
} winconsoleio;
|
||||
|
||||
|
||||
static int execfunc(PyObject *m)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
PyModuleDef_Slot testconsole_slots[] = {
|
||||
{Py_mod_exec, execfunc},
|
||||
{0, NULL},
|
||||
};
|
||||
|
||||
/*[clinic input]
|
||||
module _testconsole
|
||||
|
||||
_testconsole.write_input
|
||||
file: object
|
||||
s: PyBytesObject
|
||||
|
||||
Writes UTF-16-LE encoded bytes to the console as if typed by a user.
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
_testconsole_write_input_impl(PyObject *module, PyObject *file,
|
||||
PyBytesObject *s)
|
||||
/*[clinic end generated code: output=48f9563db34aedb3 input=4c774f2d05770bc6]*/
|
||||
{
|
||||
INPUT_RECORD *rec = NULL;
|
||||
|
||||
if (!PyWindowsConsoleIO_Check(file)) {
|
||||
PyErr_SetString(PyExc_TypeError, "expected raw console object");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const wchar_t *p = (const wchar_t *)PyBytes_AS_STRING(s);
|
||||
DWORD size = (DWORD)PyBytes_GET_SIZE(s) / sizeof(wchar_t);
|
||||
|
||||
rec = (INPUT_RECORD*)PyMem_Malloc(sizeof(INPUT_RECORD) * size);
|
||||
if (!rec)
|
||||
goto error;
|
||||
memset(rec, 0, sizeof(INPUT_RECORD) * size);
|
||||
|
||||
INPUT_RECORD *prec = rec;
|
||||
for (DWORD i = 0; i < size; ++i, ++p, ++prec) {
|
||||
prec->EventType = KEY_EVENT;
|
||||
prec->Event.KeyEvent.bKeyDown = TRUE;
|
||||
prec->Event.KeyEvent.wRepeatCount = 10;
|
||||
prec->Event.KeyEvent.uChar.UnicodeChar = *p;
|
||||
}
|
||||
|
||||
HANDLE hInput = ((winconsoleio*)file)->handle;
|
||||
DWORD total = 0;
|
||||
while (total < size) {
|
||||
DWORD wrote;
|
||||
if (!WriteConsoleInputW(hInput, &rec[total], (size - total), &wrote)) {
|
||||
PyErr_SetFromWindowsErr(0);
|
||||
goto error;
|
||||
}
|
||||
total += wrote;
|
||||
}
|
||||
|
||||
PyMem_Free((void*)rec);
|
||||
|
||||
Py_RETURN_NONE;
|
||||
error:
|
||||
if (rec)
|
||||
PyMem_Free((void*)rec);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*[clinic input]
|
||||
_testconsole.read_output
|
||||
file: object
|
||||
|
||||
Reads a str from the console as written to stdout.
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
_testconsole_read_output_impl(PyObject *module, PyObject *file)
|
||||
/*[clinic end generated code: output=876310d81a73e6d2 input=b3521f64b1b558e3]*/
|
||||
{
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
#include "clinic\_testconsole.c.h"
|
||||
|
||||
PyMethodDef testconsole_methods[] = {
|
||||
_TESTCONSOLE_WRITE_INPUT_METHODDEF
|
||||
_TESTCONSOLE_READ_OUTPUT_METHODDEF
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
static PyModuleDef testconsole_def = {
|
||||
PyModuleDef_HEAD_INIT, /* m_base */
|
||||
"_testconsole", /* m_name */
|
||||
PyDoc_STR("Test module for the Windows console"), /* m_doc */
|
||||
0, /* m_size */
|
||||
testconsole_methods, /* m_methods */
|
||||
testconsole_slots, /* m_slots */
|
||||
NULL, /* m_traverse */
|
||||
NULL, /* m_clear */
|
||||
NULL, /* m_free */
|
||||
};
|
||||
|
||||
PyMODINIT_FUNC
|
||||
PyInit__testconsole(PyObject *spec)
|
||||
{
|
||||
return PyModuleDef_Init(&testconsole_def);
|
||||
}
|
||||
|
||||
#endif /* MS_WINDOWS */
|
Before Width: | Height: | Size: 2.5 KiB |
|
@ -1,5 +0,0 @@
|
|||
|
||||
XXX Write description
|
||||
XXX Dont't forget to mention upx
|
||||
|
||||
XXX Add pointer to this file into PC/README.txt
|
104
third_party/python/PC/bdist_wininst/archive.h
vendored
|
@ -1,104 +0,0 @@
|
|||
/*
|
||||
IMPORTANT NOTE: IF THIS FILE IS CHANGED, PCBUILD\BDIST_WININST.VCXPROJ MUST
|
||||
BE REBUILT AS WELL.
|
||||
|
||||
IF CHANGES TO THIS FILE ARE CHECKED IN, THE RECOMPILED BINARIES MUST BE
|
||||
CHECKED IN AS WELL!
|
||||
*/
|
||||
|
||||
#pragma pack(1)
|
||||
|
||||
/* zip-archive headers
|
||||
* See: http://www.pkware.com/appnote.html
|
||||
*/
|
||||
|
||||
struct eof_cdir {
|
||||
long tag; /* must be 0x06054b50 */
|
||||
short disknum;
|
||||
short firstdisk;
|
||||
short nTotalCDirThis;
|
||||
short nTotalCDir;
|
||||
long nBytesCDir;
|
||||
long ofsCDir;
|
||||
short commentlen;
|
||||
};
|
||||
|
||||
struct cdir {
|
||||
long tag; /* must be 0x02014b50 */
|
||||
short version_made;
|
||||
short version_extract;
|
||||
short gp_bitflag;
|
||||
short comp_method;
|
||||
short last_mod_file_time;
|
||||
short last_mod_file_date;
|
||||
long crc32;
|
||||
long comp_size;
|
||||
long uncomp_size;
|
||||
short fname_length;
|
||||
short extra_length;
|
||||
short comment_length;
|
||||
short disknum_start;
|
||||
short int_file_attr;
|
||||
long ext_file_attr;
|
||||
long ofs_local_header;
|
||||
};
|
||||
|
||||
struct fhdr {
|
||||
long tag; /* must be 0x04034b50 */
|
||||
short version_needed;
|
||||
short flags;
|
||||
short method;
|
||||
short last_mod_file_time;
|
||||
short last_mod_file_date;
|
||||
long crc32;
|
||||
long comp_size;
|
||||
long uncomp_size;
|
||||
short fname_length;
|
||||
short extra_length;
|
||||
};
|
||||
|
||||
|
||||
struct meta_data_hdr {
|
||||
int tag;
|
||||
int uncomp_size;
|
||||
int bitmap_size;
|
||||
};
|
||||
|
||||
#pragma pack()
|
||||
|
||||
/* installation scheme */
|
||||
|
||||
typedef struct tagSCHEME {
|
||||
char *name;
|
||||
char *prefix;
|
||||
} SCHEME;
|
||||
|
||||
typedef int (*NOTIFYPROC)(int code, LPSTR text, ...);
|
||||
|
||||
extern BOOL
|
||||
extract_file(char *dst, char *src, int method, int comp_size,
|
||||
int uncomp_size, NOTIFYPROC notify);
|
||||
|
||||
extern BOOL
|
||||
unzip_archive(SCHEME *scheme, char *dirname, char *data,
|
||||
DWORD size, NOTIFYPROC notify);
|
||||
|
||||
extern char *
|
||||
map_new_file(DWORD flags, char *filename, char
|
||||
*pathname_part, int size,
|
||||
WORD wFatDate, WORD wFatTime,
|
||||
NOTIFYPROC callback);
|
||||
|
||||
extern BOOL
|
||||
ensure_directory (char *pathname, char *new_part,
|
||||
NOTIFYPROC callback);
|
||||
|
||||
/* codes for NOITIFYPROC */
|
||||
#define DIR_CREATED 1
|
||||
#define CAN_OVERWRITE 2
|
||||
#define FILE_CREATED 3
|
||||
#define ZLIB_ERROR 4
|
||||
#define SYSTEM_ERROR 5
|
||||
#define NUM_FILES 6
|
||||
#define FILE_OVERWRITTEN 7
|
||||
|
|
@ -1,108 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="PGInstrument|Win32">
|
||||
<Configuration>PGInstrument</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="PGInstrument|x64">
|
||||
<Configuration>PGInstrument</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="PGUpdate|Win32">
|
||||
<Configuration>PGUpdate</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="PGUpdate|x64">
|
||||
<Configuration>PGUpdate</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{EB1C19C1-1F18-421E-9735-CAEE69DC6A3C}</ProjectGuid>
|
||||
<RootNamespace>wininst</RootNamespace>
|
||||
<SupportPGO>false</SupportPGO>
|
||||
</PropertyGroup>
|
||||
<Import Project="..\..\PCBuild\python.props" />
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>NotSet</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\..\PCBuild\pyproject.props" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup>
|
||||
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
|
||||
<OutDir>$(PySourcePath)lib\distutils\command\</OutDir>
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<TargetName>wininst-$(VisualStudioVersion)</TargetName>
|
||||
<TargetName Condition="$(PlatformToolset) == 'v140'">wininst-14.0</TargetName>
|
||||
<TargetName Condition="$(PlatformToolset) == 'v120'">wininst-12.0</TargetName>
|
||||
<TargetName Condition="$(PlatformToolset) == 'v110'">wininst-11.0</TargetName>
|
||||
<TargetName Condition="$(PlatformToolset) == 'v100'">wininst-10.0</TargetName>
|
||||
<TargetName Condition="$(Platform) == 'x64'">$(TargetName)-amd64</TargetName>
|
||||
<TargetExt>.exe</TargetExt>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup>
|
||||
<Midl>
|
||||
<TypeLibraryName>$(OutDir)wininst.tlb</TypeLibraryName>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<Optimization>MinSpace</Optimization>
|
||||
<AdditionalIncludeDirectories>$(PySourcePath)Modules\zlib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary Condition="'$(Configuration)'=='Debug'">MultiThreadedDebug</RuntimeLibrary>
|
||||
<RuntimeLibrary Condition="'$(Configuration)'=='Release'">MultiThreaded</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<AdditionalIncludeDirectories>$(PySourcePath)PC\bdist_wininst;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>comctl32.lib;imagehlp.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="extract.c" />
|
||||
<ClCompile Include="install.c" />
|
||||
<ClCompile Include="..\..\Modules\zlib\adler32.c" />
|
||||
<ClCompile Include="..\..\Modules\zlib\crc32.c" />
|
||||
<ClCompile Include="..\..\Modules\zlib\inffast.c" />
|
||||
<ClCompile Include="..\..\Modules\zlib\inflate.c" />
|
||||
<ClCompile Include="..\..\Modules\zlib\inftrees.c" />
|
||||
<ClCompile Include="..\..\Modules\zlib\zutil.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="archive.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="install.rc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="PythonPowered.bmp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
|
@ -1,61 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{293b1092-03ad-4b7c-acb9-c4ab62e52f55}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cxx;rc;def;r;odl;idl;hpj;bat</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\zlib">
|
||||
<UniqueIdentifier>{0edc0406-282f-4dbc-b60e-a867c34a2a31}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{ea0c0f0e-3b73-474e-a999-e9689d032ccc}</UniqueIdentifier>
|
||||
<Extensions>h;hpp;hxx;hm;inl</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{0c77c1cf-3f87-4f87-bd86-b425211c2181}</UniqueIdentifier>
|
||||
<Extensions>ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\PC\bdist_wininst\extract.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\PC\bdist_wininst\install.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\Modules\zlib\adler32.c">
|
||||
<Filter>Source Files\zlib</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\Modules\zlib\crc32.c">
|
||||
<Filter>Source Files\zlib</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\Modules\zlib\inffast.c">
|
||||
<Filter>Source Files\zlib</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\Modules\zlib\inflate.c">
|
||||
<Filter>Source Files\zlib</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\Modules\zlib\inftrees.c">
|
||||
<Filter>Source Files\zlib</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\Modules\zlib\zutil.c">
|
||||
<Filter>Source Files\zlib</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\PC\bdist_wininst\archive.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="..\PC\bdist_wininst\install.rc">
|
||||
<Filter>Resource Files</Filter>
|
||||
</ResourceCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\PC\bdist_wininst\PythonPowered.bmp">
|
||||
<Filter>Resource Files</Filter>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
</Project>
|
19
third_party/python/PC/bdist_wininst/build.bat
vendored
|
@ -1,19 +0,0 @@
|
|||
@echo off
|
||||
setlocal
|
||||
|
||||
set D=%~dp0
|
||||
set PCBUILD=%~dp0..\..\PCBuild\
|
||||
|
||||
|
||||
echo Building Lib\distutils\command\wininst-xx.0.exe
|
||||
|
||||
call "%PCBUILD%find_msbuild.bat" %MSBUILD%
|
||||
if ERRORLEVEL 1 (echo Cannot locate MSBuild.exe on PATH or as MSBUILD variable & exit /b 2)
|
||||
|
||||
%MSBUILD% "%D%bdist_wininst.vcxproj" "/p:SolutionDir=%PCBUILD%\" /p:Configuration=Release /p:Platform=Win32
|
||||
if errorlevel 1 goto :eof
|
||||
|
||||
|
||||
echo Building Lib\distutils\command\wininst-xx.0-amd64.exe
|
||||
|
||||
%MSBUILD% "%D%bdist_wininst.vcxproj" "/p:SolutionDir=%PCBUILD%\" /p:Configuration=Release /p:Platform=x64
|
320
third_party/python/PC/bdist_wininst/extract.c
vendored
|
@ -1,320 +0,0 @@
|
|||
/*
|
||||
IMPORTANT NOTE: IF THIS FILE IS CHANGED, PCBUILD\BDIST_WININST.VCXPROJ MUST
|
||||
BE REBUILT AS WELL.
|
||||
|
||||
IF CHANGES TO THIS FILE ARE CHECKED IN, THE RECOMPILED BINARIES MUST BE
|
||||
CHECKED IN AS WELL!
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#include "zlib.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "archive.h"
|
||||
|
||||
/* Convert unix-path to dos-path */
|
||||
static void normpath(char *path)
|
||||
{
|
||||
while (path && *path) {
|
||||
if (*path == '/')
|
||||
*path = '\\';
|
||||
++path;
|
||||
}
|
||||
}
|
||||
|
||||
BOOL ensure_directory(char *pathname, char *new_part, NOTIFYPROC notify)
|
||||
{
|
||||
while (new_part && *new_part && (new_part = strchr(new_part, '\\'))) {
|
||||
DWORD attr;
|
||||
*new_part = '\0';
|
||||
attr = GetFileAttributes(pathname);
|
||||
if (attr == -1) {
|
||||
/* nothing found */
|
||||
if (!CreateDirectory(pathname, NULL) && notify)
|
||||
notify(SYSTEM_ERROR,
|
||||
"CreateDirectory (%s)", pathname);
|
||||
else
|
||||
notify(DIR_CREATED, pathname);
|
||||
}
|
||||
if (attr & FILE_ATTRIBUTE_DIRECTORY) {
|
||||
;
|
||||
} else {
|
||||
SetLastError(183);
|
||||
if (notify)
|
||||
notify(SYSTEM_ERROR,
|
||||
"CreateDirectory (%s)", pathname);
|
||||
}
|
||||
*new_part = '\\';
|
||||
++new_part;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* XXX Should better explicitly specify
|
||||
* uncomp_size and file_times instead of pfhdr!
|
||||
*/
|
||||
char *map_new_file(DWORD flags, char *filename,
|
||||
char *pathname_part, int size,
|
||||
WORD wFatDate, WORD wFatTime,
|
||||
NOTIFYPROC notify)
|
||||
{
|
||||
HANDLE hFile, hFileMapping;
|
||||
char *dst;
|
||||
FILETIME ft;
|
||||
|
||||
try_again:
|
||||
if (!flags)
|
||||
flags = CREATE_NEW;
|
||||
hFile = CreateFile(filename,
|
||||
GENERIC_WRITE | GENERIC_READ,
|
||||
0, NULL,
|
||||
flags,
|
||||
FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
if (hFile == INVALID_HANDLE_VALUE) {
|
||||
DWORD x = GetLastError();
|
||||
switch (x) {
|
||||
case ERROR_FILE_EXISTS:
|
||||
if (notify && notify(CAN_OVERWRITE, filename))
|
||||
hFile = CreateFile(filename,
|
||||
GENERIC_WRITE|GENERIC_READ,
|
||||
0, NULL,
|
||||
CREATE_ALWAYS,
|
||||
FILE_ATTRIBUTE_NORMAL,
|
||||
NULL);
|
||||
else {
|
||||
if (notify)
|
||||
notify(FILE_OVERWRITTEN, filename);
|
||||
return NULL;
|
||||
}
|
||||
break;
|
||||
case ERROR_PATH_NOT_FOUND:
|
||||
if (ensure_directory(filename, pathname_part, notify))
|
||||
goto try_again;
|
||||
else
|
||||
return FALSE;
|
||||
break;
|
||||
default:
|
||||
SetLastError(x);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (hFile == INVALID_HANDLE_VALUE) {
|
||||
if (notify)
|
||||
notify (SYSTEM_ERROR, "CreateFile (%s)", filename);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (notify)
|
||||
notify(FILE_CREATED, filename);
|
||||
|
||||
DosDateTimeToFileTime(wFatDate, wFatTime, &ft);
|
||||
SetFileTime(hFile, &ft, &ft, &ft);
|
||||
|
||||
|
||||
if (size == 0) {
|
||||
/* We cannot map a zero-length file (Also it makes
|
||||
no sense */
|
||||
CloseHandle(hFile);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
hFileMapping = CreateFileMapping(hFile,
|
||||
NULL, PAGE_READWRITE, 0, size, NULL);
|
||||
|
||||
CloseHandle(hFile);
|
||||
|
||||
if (hFileMapping == NULL) {
|
||||
if (notify)
|
||||
notify(SYSTEM_ERROR,
|
||||
"CreateFileMapping (%s)", filename);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
dst = MapViewOfFile(hFileMapping,
|
||||
FILE_MAP_WRITE, 0, 0, 0);
|
||||
|
||||
CloseHandle(hFileMapping);
|
||||
|
||||
if (!dst) {
|
||||
if (notify)
|
||||
notify(SYSTEM_ERROR, "MapViewOfFile (%s)", filename);
|
||||
return NULL;
|
||||
}
|
||||
return dst;
|
||||
}
|
||||
|
||||
|
||||
BOOL
|
||||
extract_file(char *dst, char *src, int method, int comp_size,
|
||||
int uncomp_size, NOTIFYPROC notify)
|
||||
{
|
||||
z_stream zstream;
|
||||
int result;
|
||||
|
||||
if (method == Z_DEFLATED) {
|
||||
int x;
|
||||
memset(&zstream, 0, sizeof(zstream));
|
||||
zstream.next_in = src;
|
||||
zstream.avail_in = comp_size+1;
|
||||
zstream.next_out = dst;
|
||||
zstream.avail_out = uncomp_size;
|
||||
|
||||
/* Apparently an undocumented feature of zlib: Set windowsize
|
||||
to negative values to suppress the gzip header and be compatible with
|
||||
zip! */
|
||||
result = TRUE;
|
||||
if (Z_OK != (x = inflateInit2(&zstream, -15))) {
|
||||
if (notify)
|
||||
notify(ZLIB_ERROR,
|
||||
"inflateInit2 returns %d", x);
|
||||
result = FALSE;
|
||||
goto cleanup;
|
||||
}
|
||||
if (Z_STREAM_END != (x = inflate(&zstream, Z_FINISH))) {
|
||||
if (notify)
|
||||
notify(ZLIB_ERROR,
|
||||
"inflate returns %d", x);
|
||||
result = FALSE;
|
||||
}
|
||||
cleanup:
|
||||
if (Z_OK != (x = inflateEnd(&zstream))) {
|
||||
if (notify)
|
||||
notify (ZLIB_ERROR,
|
||||
"inflateEnd returns %d", x);
|
||||
result = FALSE;
|
||||
}
|
||||
} else if (method == 0) {
|
||||
memcpy(dst, src, uncomp_size);
|
||||
result = TRUE;
|
||||
} else
|
||||
result = FALSE;
|
||||
UnmapViewOfFile(dst);
|
||||
return result;
|
||||
}
|
||||
|
||||
/* Open a zip-compatible archive and extract all files
|
||||
* into the specified directory (which is assumed to exist)
|
||||
*/
|
||||
BOOL
|
||||
unzip_archive(SCHEME *scheme, char *dirname, char *data, DWORD size,
|
||||
NOTIFYPROC notify)
|
||||
{
|
||||
int n;
|
||||
char pathname[MAX_PATH];
|
||||
char *new_part;
|
||||
|
||||
/* read the end of central directory record */
|
||||
struct eof_cdir *pe = (struct eof_cdir *)&data[size - sizeof
|
||||
(struct eof_cdir)];
|
||||
|
||||
int arc_start = size - sizeof (struct eof_cdir) - pe->nBytesCDir -
|
||||
pe->ofsCDir;
|
||||
|
||||
/* set position to start of central directory */
|
||||
int pos = arc_start + pe->ofsCDir;
|
||||
|
||||
/* make sure this is a zip file */
|
||||
if (pe->tag != 0x06054b50)
|
||||
return FALSE;
|
||||
|
||||
/* Loop through the central directory, reading all entries */
|
||||
for (n = 0; n < pe->nTotalCDir; ++n) {
|
||||
int i;
|
||||
char *fname;
|
||||
char *pcomp;
|
||||
char *dst;
|
||||
struct cdir *pcdir;
|
||||
struct fhdr *pfhdr;
|
||||
|
||||
pcdir = (struct cdir *)&data[pos];
|
||||
pfhdr = (struct fhdr *)&data[pcdir->ofs_local_header +
|
||||
arc_start];
|
||||
|
||||
if (pcdir->tag != 0x02014b50)
|
||||
return FALSE;
|
||||
if (pfhdr->tag != 0x04034b50)
|
||||
return FALSE;
|
||||
pos += sizeof(struct cdir);
|
||||
fname = (char *)&data[pos]; /* This is not null terminated! */
|
||||
pos += pcdir->fname_length + pcdir->extra_length +
|
||||
pcdir->comment_length;
|
||||
|
||||
pcomp = &data[pcdir->ofs_local_header
|
||||
+ sizeof(struct fhdr)
|
||||
+ arc_start
|
||||
+ pfhdr->fname_length
|
||||
+ pfhdr->extra_length];
|
||||
|
||||
/* dirname is the Python home directory (prefix) */
|
||||
strcpy(pathname, dirname);
|
||||
if (pathname[strlen(pathname)-1] != '\\')
|
||||
strcat(pathname, "\\");
|
||||
new_part = &pathname[lstrlen(pathname)];
|
||||
/* we must now match the first part of the pathname
|
||||
* in the archive to a component in the installation
|
||||
* scheme (PURELIB, PLATLIB, HEADERS, SCRIPTS, or DATA)
|
||||
* and replace this part by the one in the scheme to use
|
||||
*/
|
||||
for (i = 0; scheme[i].name; ++i) {
|
||||
if (0 == strnicmp(scheme[i].name, fname,
|
||||
strlen(scheme[i].name))) {
|
||||
char *rest;
|
||||
int len;
|
||||
|
||||
/* length of the replaced part */
|
||||
int namelen = strlen(scheme[i].name);
|
||||
|
||||
strcat(pathname, scheme[i].prefix);
|
||||
|
||||
rest = fname + namelen;
|
||||
len = pfhdr->fname_length - namelen;
|
||||
|
||||
if ((pathname[strlen(pathname)-1] != '\\')
|
||||
&& (pathname[strlen(pathname)-1] != '/'))
|
||||
strcat(pathname, "\\");
|
||||
/* Now that pathname ends with a separator,
|
||||
* we must make sure rest does not start with
|
||||
* an additional one.
|
||||
*/
|
||||
if ((rest[0] == '\\') || (rest[0] == '/')) {
|
||||
++rest;
|
||||
--len;
|
||||
}
|
||||
|
||||
strncat(pathname, rest, len);
|
||||
goto Done;
|
||||
}
|
||||
}
|
||||
/* no prefix to replace found, go unchanged */
|
||||
strncat(pathname, fname, pfhdr->fname_length);
|
||||
Done:
|
||||
normpath(pathname);
|
||||
if (pathname[strlen(pathname)-1] != '\\') {
|
||||
/*
|
||||
* The local file header (pfhdr) does not always
|
||||
* contain the compressed and uncompressed sizes of
|
||||
* the data depending on bit 3 of the flags field. So
|
||||
* it seems better to use the data from the central
|
||||
* directory (pcdir).
|
||||
*/
|
||||
dst = map_new_file(0, pathname, new_part,
|
||||
pcdir->uncomp_size,
|
||||
pcdir->last_mod_file_date,
|
||||
pcdir->last_mod_file_time, notify);
|
||||
if (dst) {
|
||||
if (!extract_file(dst, pcomp, pfhdr->method,
|
||||
pcdir->comp_size,
|
||||
pcdir->uncomp_size,
|
||||
notify))
|
||||
return FALSE;
|
||||
} /* else ??? */
|
||||
}
|
||||
if (notify)
|
||||
notify(NUM_FILES, new_part, (int)pe->nTotalCDir,
|
||||
(int)n+1);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
2700
third_party/python/PC/bdist_wininst/install.c
vendored
77
third_party/python/PC/bdist_wininst/install.rc
vendored
|
@ -1,77 +0,0 @@
|
|||
/*
|
||||
IMPORTANT NOTE: IF THIS FILE IS CHANGED, PCBUILD\BDIST_WININST.VCXPROJ MUST
|
||||
BE REBUILT AS WELL.
|
||||
|
||||
IF CHANGES TO THIS FILE ARE CHECKED IN, THE RECOMPILED BINARIES MUST BE
|
||||
CHECKED IN AS WELL!
|
||||
*/
|
||||
|
||||
#include <winres.h>
|
||||
#include "resource.h"
|
||||
|
||||
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
|
||||
#pragma code_page(1252)
|
||||
|
||||
IDB_BITMAP BITMAP DISCARDABLE "PythonPowered.bmp"
|
||||
|
||||
|
||||
IDD_INTRO DIALOGEX 0, 0, 379, 178
|
||||
STYLE WS_CHILD | WS_DISABLED | WS_CAPTION
|
||||
CAPTION "Setup"
|
||||
FONT 8, "MS Sans Serif", 0, 0, 0x1
|
||||
BEGIN
|
||||
LTEXT "This Wizard will install %s on your computer. Click Next to continue or Cancel to exit the Setup Wizard.",
|
||||
IDC_TITLE,125,10,247,20,NOT WS_GROUP
|
||||
EDITTEXT IDC_INTRO_TEXT,125,31,247,131,ES_MULTILINE | ES_READONLY |
|
||||
WS_VSCROLL | WS_HSCROLL | NOT WS_TABSTOP
|
||||
CONTROL 110,IDC_BITMAP,"Static",SS_BITMAP | SS_CENTERIMAGE,6,8,
|
||||
104,163,WS_EX_CLIENTEDGE
|
||||
LTEXT "",IDC_BUILD_INFO,125,163,247,8
|
||||
END
|
||||
|
||||
IDD_SELECTPYTHON DIALOGEX 0, 0, 379, 178
|
||||
STYLE WS_CHILD | WS_DISABLED | WS_CAPTION
|
||||
CAPTION "Setup"
|
||||
FONT 8, "MS Sans Serif", 0, 0, 0x1
|
||||
BEGIN
|
||||
LTEXT "Select python installation to use:",IDC_TITLE,125,10,
|
||||
247,12,NOT WS_GROUP
|
||||
EDITTEXT IDC_PATH,191,136,181,14,ES_AUTOHSCROLL | ES_READONLY
|
||||
LTEXT "Python Directory:",IDC_STATIC,125,137,55,8
|
||||
LISTBOX IDC_VERSIONS_LIST,125,24,247,106,LBS_SORT |
|
||||
LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
|
||||
CONTROL 110,IDC_BITMAP,"Static",SS_BITMAP | SS_CENTERIMAGE,6,8,
|
||||
104,163,WS_EX_CLIENTEDGE
|
||||
EDITTEXT IDC_INSTALL_PATH,191,157,181,14,ES_AUTOHSCROLL |
|
||||
ES_READONLY
|
||||
LTEXT "Installation Directory:",IDC_STATIC,125,158,66,8
|
||||
PUSHBUTTON "Find other ...",IDC_OTHERPYTHON,322,7,50,14,NOT
|
||||
WS_VISIBLE
|
||||
END
|
||||
|
||||
IDD_INSTALLFILES DIALOGEX 0, 0, 379, 178
|
||||
STYLE WS_CHILD | WS_DISABLED | WS_CAPTION
|
||||
CAPTION "Setup"
|
||||
FONT 8, "MS Sans Serif", 0, 0, 0x1
|
||||
BEGIN
|
||||
LTEXT "Click Next to begin the installation. If you want to review or change any of your installation settings, click Back. Click Cancel to exit the Wizard.",
|
||||
IDC_TITLE,125,10,246,31,NOT WS_GROUP
|
||||
CONTROL "Progress1",IDC_PROGRESS,"msctls_progress32",WS_BORDER,
|
||||
125,157,246,14
|
||||
CTEXT "Installation progress:",IDC_INFO,125,137,246,8
|
||||
CONTROL 110,IDC_BITMAP,"Static",SS_BITMAP | SS_CENTERIMAGE,6,8,
|
||||
104,163,WS_EX_CLIENTEDGE
|
||||
END
|
||||
|
||||
IDD_FINISHED DIALOGEX 0, 0, 379, 178
|
||||
STYLE WS_CHILD | WS_DISABLED | WS_CAPTION
|
||||
CAPTION "Setup"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
LTEXT "Click the Finish button to exit the Setup wizard.",
|
||||
IDC_TITLE,125,10,247,31,NOT WS_GROUP
|
||||
CONTROL 110,IDC_BITMAP,"Static",SS_BITMAP | SS_CENTERIMAGE,6,8,
|
||||
104,163,WS_EX_CLIENTEDGE
|
||||
EDITTEXT IDC_INFO,125,40,247,131,ES_MULTILINE | ES_READONLY |
|
||||
WS_VSCROLL | WS_HSCROLL | NOT WS_TABSTOP
|
||||
END
|
31
third_party/python/PC/bdist_wininst/resource.h
vendored
|
@ -1,31 +0,0 @@
|
|||
/*
|
||||
IMPORTANT NOTE: IF THIS FILE IS CHANGED, PCBUILD\BDIST_WININST.VCXPROJ MUST
|
||||
BE REBUILT AS WELL.
|
||||
|
||||
IF CHANGES TO THIS FILE ARE CHECKED IN, THE RECOMPILED BINARIES MUST BE
|
||||
CHECKED IN AS WELL!
|
||||
*/
|
||||
|
||||
#define IDD_DIALOG1 101
|
||||
#define IDB_BITMAP1 103
|
||||
#define IDD_INTRO 107
|
||||
#define IDD_SELECTPYTHON 108
|
||||
#define IDD_INSTALLFILES 109
|
||||
#define IDD_FINISHED 110
|
||||
#define IDB_BITMAP 110
|
||||
#define IDC_EDIT1 1000
|
||||
#define IDC_TITLE 1000
|
||||
#define IDC_START 1001
|
||||
#define IDC_PROGRESS 1003
|
||||
#define IDC_INFO 1004
|
||||
#define IDC_PYTHON15 1006
|
||||
#define IDC_PATH 1007
|
||||
#define IDC_PYTHON16 1008
|
||||
#define IDC_INSTALL_PATH 1008
|
||||
#define IDC_PYTHON20 1009
|
||||
#define IDC_BROWSE 1010
|
||||
#define IDC_INTRO_TEXT 1021
|
||||
#define IDC_VERSIONS_LIST 1022
|
||||
#define IDC_BUILD_INFO 1024
|
||||
#define IDC_BITMAP 1025
|
||||
#define IDC_OTHERPYTHON 1026
|
82
third_party/python/PC/clinic/_testconsole.c.h
generated
vendored
|
@ -1,82 +0,0 @@
|
|||
/*[clinic input]
|
||||
preserve
|
||||
[clinic start generated code]*/
|
||||
|
||||
#if defined(MS_WINDOWS)
|
||||
|
||||
PyDoc_STRVAR(_testconsole_write_input__doc__,
|
||||
"write_input($module, /, file, s)\n"
|
||||
"--\n"
|
||||
"\n"
|
||||
"Writes UTF-16-LE encoded bytes to the console as if typed by a user.");
|
||||
|
||||
#define _TESTCONSOLE_WRITE_INPUT_METHODDEF \
|
||||
{"write_input", (PyCFunction)_testconsole_write_input, METH_FASTCALL, _testconsole_write_input__doc__},
|
||||
|
||||
static PyObject *
|
||||
_testconsole_write_input_impl(PyObject *module, PyObject *file,
|
||||
PyBytesObject *s);
|
||||
|
||||
static PyObject *
|
||||
_testconsole_write_input(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||
{
|
||||
PyObject *return_value = NULL;
|
||||
static const char * const _keywords[] = {"file", "s", NULL};
|
||||
static _PyArg_Parser _parser = {"OS:write_input", _keywords, 0};
|
||||
PyObject *file;
|
||||
PyBytesObject *s;
|
||||
|
||||
if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
|
||||
&file, &s)) {
|
||||
goto exit;
|
||||
}
|
||||
return_value = _testconsole_write_input_impl(module, file, s);
|
||||
|
||||
exit:
|
||||
return return_value;
|
||||
}
|
||||
|
||||
#endif /* defined(MS_WINDOWS) */
|
||||
|
||||
#if defined(MS_WINDOWS)
|
||||
|
||||
PyDoc_STRVAR(_testconsole_read_output__doc__,
|
||||
"read_output($module, /, file)\n"
|
||||
"--\n"
|
||||
"\n"
|
||||
"Reads a str from the console as written to stdout.");
|
||||
|
||||
#define _TESTCONSOLE_READ_OUTPUT_METHODDEF \
|
||||
{"read_output", (PyCFunction)_testconsole_read_output, METH_FASTCALL, _testconsole_read_output__doc__},
|
||||
|
||||
static PyObject *
|
||||
_testconsole_read_output_impl(PyObject *module, PyObject *file);
|
||||
|
||||
static PyObject *
|
||||
_testconsole_read_output(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||
{
|
||||
PyObject *return_value = NULL;
|
||||
static const char * const _keywords[] = {"file", NULL};
|
||||
static _PyArg_Parser _parser = {"O:read_output", _keywords, 0};
|
||||
PyObject *file;
|
||||
|
||||
if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
|
||||
&file)) {
|
||||
goto exit;
|
||||
}
|
||||
return_value = _testconsole_read_output_impl(module, file);
|
||||
|
||||
exit:
|
||||
return return_value;
|
||||
}
|
||||
|
||||
#endif /* defined(MS_WINDOWS) */
|
||||
|
||||
#ifndef _TESTCONSOLE_WRITE_INPUT_METHODDEF
|
||||
#define _TESTCONSOLE_WRITE_INPUT_METHODDEF
|
||||
#endif /* !defined(_TESTCONSOLE_WRITE_INPUT_METHODDEF) */
|
||||
|
||||
#ifndef _TESTCONSOLE_READ_OUTPUT_METHODDEF
|
||||
#define _TESTCONSOLE_READ_OUTPUT_METHODDEF
|
||||
#endif /* !defined(_TESTCONSOLE_READ_OUTPUT_METHODDEF) */
|
||||
/*[clinic end generated code: output=3a8dc0c421807c41 input=a9049054013a1b77]*/
|
572
third_party/python/PC/clinic/msvcrtmodule.c.h
generated
vendored
|
@ -1,572 +0,0 @@
|
|||
/*[clinic input]
|
||||
preserve
|
||||
[clinic start generated code]*/
|
||||
|
||||
PyDoc_STRVAR(msvcrt_heapmin__doc__,
|
||||
"heapmin($module, /)\n"
|
||||
"--\n"
|
||||
"\n"
|
||||
"Minimize the malloc() heap.\n"
|
||||
"\n"
|
||||
"Force the malloc() heap to clean itself up and return unused blocks\n"
|
||||
"to the operating system. On failure, this raises OSError.");
|
||||
|
||||
#define MSVCRT_HEAPMIN_METHODDEF \
|
||||
{"heapmin", (PyCFunction)msvcrt_heapmin, METH_NOARGS, msvcrt_heapmin__doc__},
|
||||
|
||||
static PyObject *
|
||||
msvcrt_heapmin_impl(PyObject *module);
|
||||
|
||||
static PyObject *
|
||||
msvcrt_heapmin(PyObject *module, PyObject *Py_UNUSED(ignored))
|
||||
{
|
||||
return msvcrt_heapmin_impl(module);
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(msvcrt_locking__doc__,
|
||||
"locking($module, fd, mode, nbytes, /)\n"
|
||||
"--\n"
|
||||
"\n"
|
||||
"Lock part of a file based on file descriptor fd from the C runtime.\n"
|
||||
"\n"
|
||||
"Raises IOError on failure. The locked region of the file extends from\n"
|
||||
"the current file position for nbytes bytes, and may continue beyond\n"
|
||||
"the end of the file. mode must be one of the LK_* constants listed\n"
|
||||
"below. Multiple regions in a file may be locked at the same time, but\n"
|
||||
"may not overlap. Adjacent regions are not merged; they must be unlocked\n"
|
||||
"individually.");
|
||||
|
||||
#define MSVCRT_LOCKING_METHODDEF \
|
||||
{"locking", (PyCFunction)msvcrt_locking, METH_VARARGS, msvcrt_locking__doc__},
|
||||
|
||||
static PyObject *
|
||||
msvcrt_locking_impl(PyObject *module, int fd, int mode, long nbytes);
|
||||
|
||||
static PyObject *
|
||||
msvcrt_locking(PyObject *module, PyObject *args)
|
||||
{
|
||||
PyObject *return_value = NULL;
|
||||
int fd;
|
||||
int mode;
|
||||
long nbytes;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "iil:locking",
|
||||
&fd, &mode, &nbytes)) {
|
||||
goto exit;
|
||||
}
|
||||
return_value = msvcrt_locking_impl(module, fd, mode, nbytes);
|
||||
|
||||
exit:
|
||||
return return_value;
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(msvcrt_setmode__doc__,
|
||||
"setmode($module, fd, mode, /)\n"
|
||||
"--\n"
|
||||
"\n"
|
||||
"Set the line-end translation mode for the file descriptor fd.\n"
|
||||
"\n"
|
||||
"To set it to text mode, flags should be os.O_TEXT; for binary, it\n"
|
||||
"should be os.O_BINARY.\n"
|
||||
"\n"
|
||||
"Return value is the previous mode.");
|
||||
|
||||
#define MSVCRT_SETMODE_METHODDEF \
|
||||
{"setmode", (PyCFunction)msvcrt_setmode, METH_VARARGS, msvcrt_setmode__doc__},
|
||||
|
||||
static long
|
||||
msvcrt_setmode_impl(PyObject *module, int fd, int flags);
|
||||
|
||||
static PyObject *
|
||||
msvcrt_setmode(PyObject *module, PyObject *args)
|
||||
{
|
||||
PyObject *return_value = NULL;
|
||||
int fd;
|
||||
int flags;
|
||||
long _return_value;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "ii:setmode",
|
||||
&fd, &flags)) {
|
||||
goto exit;
|
||||
}
|
||||
_return_value = msvcrt_setmode_impl(module, fd, flags);
|
||||
if ((_return_value == -1) && PyErr_Occurred()) {
|
||||
goto exit;
|
||||
}
|
||||
return_value = PyLong_FromLong(_return_value);
|
||||
|
||||
exit:
|
||||
return return_value;
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(msvcrt_open_osfhandle__doc__,
|
||||
"open_osfhandle($module, handle, flags, /)\n"
|
||||
"--\n"
|
||||
"\n"
|
||||
"Create a C runtime file descriptor from the file handle handle.\n"
|
||||
"\n"
|
||||
"The flags parameter should be a bitwise OR of os.O_APPEND, os.O_RDONLY,\n"
|
||||
"and os.O_TEXT. The returned file descriptor may be used as a parameter\n"
|
||||
"to os.fdopen() to create a file object.");
|
||||
|
||||
#define MSVCRT_OPEN_OSFHANDLE_METHODDEF \
|
||||
{"open_osfhandle", (PyCFunction)msvcrt_open_osfhandle, METH_VARARGS, msvcrt_open_osfhandle__doc__},
|
||||
|
||||
static long
|
||||
msvcrt_open_osfhandle_impl(PyObject *module, intptr_t handle, int flags);
|
||||
|
||||
static PyObject *
|
||||
msvcrt_open_osfhandle(PyObject *module, PyObject *args)
|
||||
{
|
||||
PyObject *return_value = NULL;
|
||||
intptr_t handle;
|
||||
int flags;
|
||||
long _return_value;
|
||||
|
||||
if (!PyArg_ParseTuple(args, ""_Py_PARSE_INTPTR"i:open_osfhandle",
|
||||
&handle, &flags)) {
|
||||
goto exit;
|
||||
}
|
||||
_return_value = msvcrt_open_osfhandle_impl(module, handle, flags);
|
||||
if ((_return_value == -1) && PyErr_Occurred()) {
|
||||
goto exit;
|
||||
}
|
||||
return_value = PyLong_FromLong(_return_value);
|
||||
|
||||
exit:
|
||||
return return_value;
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(msvcrt_get_osfhandle__doc__,
|
||||
"get_osfhandle($module, fd, /)\n"
|
||||
"--\n"
|
||||
"\n"
|
||||
"Return the file handle for the file descriptor fd.\n"
|
||||
"\n"
|
||||
"Raises IOError if fd is not recognized.");
|
||||
|
||||
#define MSVCRT_GET_OSFHANDLE_METHODDEF \
|
||||
{"get_osfhandle", (PyCFunction)msvcrt_get_osfhandle, METH_O, msvcrt_get_osfhandle__doc__},
|
||||
|
||||
static intptr_t
|
||||
msvcrt_get_osfhandle_impl(PyObject *module, int fd);
|
||||
|
||||
static PyObject *
|
||||
msvcrt_get_osfhandle(PyObject *module, PyObject *arg)
|
||||
{
|
||||
PyObject *return_value = NULL;
|
||||
int fd;
|
||||
intptr_t _return_value;
|
||||
|
||||
if (!PyArg_Parse(arg, "i:get_osfhandle", &fd)) {
|
||||
goto exit;
|
||||
}
|
||||
_return_value = msvcrt_get_osfhandle_impl(module, fd);
|
||||
if ((_return_value == -1) && PyErr_Occurred()) {
|
||||
goto exit;
|
||||
}
|
||||
return_value = PyLong_FromVoidPtr((void *)_return_value);
|
||||
|
||||
exit:
|
||||
return return_value;
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(msvcrt_kbhit__doc__,
|
||||
"kbhit($module, /)\n"
|
||||
"--\n"
|
||||
"\n"
|
||||
"Return true if a keypress is waiting to be read.");
|
||||
|
||||
#define MSVCRT_KBHIT_METHODDEF \
|
||||
{"kbhit", (PyCFunction)msvcrt_kbhit, METH_NOARGS, msvcrt_kbhit__doc__},
|
||||
|
||||
static long
|
||||
msvcrt_kbhit_impl(PyObject *module);
|
||||
|
||||
static PyObject *
|
||||
msvcrt_kbhit(PyObject *module, PyObject *Py_UNUSED(ignored))
|
||||
{
|
||||
PyObject *return_value = NULL;
|
||||
long _return_value;
|
||||
|
||||
_return_value = msvcrt_kbhit_impl(module);
|
||||
if ((_return_value == -1) && PyErr_Occurred()) {
|
||||
goto exit;
|
||||
}
|
||||
return_value = PyLong_FromLong(_return_value);
|
||||
|
||||
exit:
|
||||
return return_value;
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(msvcrt_getch__doc__,
|
||||
"getch($module, /)\n"
|
||||
"--\n"
|
||||
"\n"
|
||||
"Read a keypress and return the resulting character as a byte string.\n"
|
||||
"\n"
|
||||
"Nothing is echoed to the console. This call will block if a keypress is\n"
|
||||
"not already available, but will not wait for Enter to be pressed. If the\n"
|
||||
"pressed key was a special function key, this will return \'\\000\' or\n"
|
||||
"\'\\xe0\'; the next call will return the keycode. The Control-C keypress\n"
|
||||
"cannot be read with this function.");
|
||||
|
||||
#define MSVCRT_GETCH_METHODDEF \
|
||||
{"getch", (PyCFunction)msvcrt_getch, METH_NOARGS, msvcrt_getch__doc__},
|
||||
|
||||
static int
|
||||
msvcrt_getch_impl(PyObject *module);
|
||||
|
||||
static PyObject *
|
||||
msvcrt_getch(PyObject *module, PyObject *Py_UNUSED(ignored))
|
||||
{
|
||||
PyObject *return_value = NULL;
|
||||
char s[1];
|
||||
|
||||
s[0] = msvcrt_getch_impl(module);
|
||||
return_value = PyBytes_FromStringAndSize(s, 1);
|
||||
|
||||
return return_value;
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(msvcrt_getwch__doc__,
|
||||
"getwch($module, /)\n"
|
||||
"--\n"
|
||||
"\n"
|
||||
"Wide char variant of getch(), returning a Unicode value.");
|
||||
|
||||
#define MSVCRT_GETWCH_METHODDEF \
|
||||
{"getwch", (PyCFunction)msvcrt_getwch, METH_NOARGS, msvcrt_getwch__doc__},
|
||||
|
||||
static wchar_t
|
||||
msvcrt_getwch_impl(PyObject *module);
|
||||
|
||||
static PyObject *
|
||||
msvcrt_getwch(PyObject *module, PyObject *Py_UNUSED(ignored))
|
||||
{
|
||||
PyObject *return_value = NULL;
|
||||
wchar_t _return_value;
|
||||
|
||||
_return_value = msvcrt_getwch_impl(module);
|
||||
return_value = PyUnicode_FromOrdinal(_return_value);
|
||||
|
||||
return return_value;
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(msvcrt_getche__doc__,
|
||||
"getche($module, /)\n"
|
||||
"--\n"
|
||||
"\n"
|
||||
"Similar to getch(), but the keypress will be echoed if possible.");
|
||||
|
||||
#define MSVCRT_GETCHE_METHODDEF \
|
||||
{"getche", (PyCFunction)msvcrt_getche, METH_NOARGS, msvcrt_getche__doc__},
|
||||
|
||||
static int
|
||||
msvcrt_getche_impl(PyObject *module);
|
||||
|
||||
static PyObject *
|
||||
msvcrt_getche(PyObject *module, PyObject *Py_UNUSED(ignored))
|
||||
{
|
||||
PyObject *return_value = NULL;
|
||||
char s[1];
|
||||
|
||||
s[0] = msvcrt_getche_impl(module);
|
||||
return_value = PyBytes_FromStringAndSize(s, 1);
|
||||
|
||||
return return_value;
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(msvcrt_getwche__doc__,
|
||||
"getwche($module, /)\n"
|
||||
"--\n"
|
||||
"\n"
|
||||
"Wide char variant of getche(), returning a Unicode value.");
|
||||
|
||||
#define MSVCRT_GETWCHE_METHODDEF \
|
||||
{"getwche", (PyCFunction)msvcrt_getwche, METH_NOARGS, msvcrt_getwche__doc__},
|
||||
|
||||
static wchar_t
|
||||
msvcrt_getwche_impl(PyObject *module);
|
||||
|
||||
static PyObject *
|
||||
msvcrt_getwche(PyObject *module, PyObject *Py_UNUSED(ignored))
|
||||
{
|
||||
PyObject *return_value = NULL;
|
||||
wchar_t _return_value;
|
||||
|
||||
_return_value = msvcrt_getwche_impl(module);
|
||||
return_value = PyUnicode_FromOrdinal(_return_value);
|
||||
|
||||
return return_value;
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(msvcrt_putch__doc__,
|
||||
"putch($module, char, /)\n"
|
||||
"--\n"
|
||||
"\n"
|
||||
"Print the byte string char to the console without buffering.");
|
||||
|
||||
#define MSVCRT_PUTCH_METHODDEF \
|
||||
{"putch", (PyCFunction)msvcrt_putch, METH_O, msvcrt_putch__doc__},
|
||||
|
||||
static PyObject *
|
||||
msvcrt_putch_impl(PyObject *module, char char_value);
|
||||
|
||||
static PyObject *
|
||||
msvcrt_putch(PyObject *module, PyObject *arg)
|
||||
{
|
||||
PyObject *return_value = NULL;
|
||||
char char_value;
|
||||
|
||||
if (!PyArg_Parse(arg, "c:putch", &char_value)) {
|
||||
goto exit;
|
||||
}
|
||||
return_value = msvcrt_putch_impl(module, char_value);
|
||||
|
||||
exit:
|
||||
return return_value;
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(msvcrt_putwch__doc__,
|
||||
"putwch($module, unicode_char, /)\n"
|
||||
"--\n"
|
||||
"\n"
|
||||
"Wide char variant of putch(), accepting a Unicode value.");
|
||||
|
||||
#define MSVCRT_PUTWCH_METHODDEF \
|
||||
{"putwch", (PyCFunction)msvcrt_putwch, METH_O, msvcrt_putwch__doc__},
|
||||
|
||||
static PyObject *
|
||||
msvcrt_putwch_impl(PyObject *module, int unicode_char);
|
||||
|
||||
static PyObject *
|
||||
msvcrt_putwch(PyObject *module, PyObject *arg)
|
||||
{
|
||||
PyObject *return_value = NULL;
|
||||
int unicode_char;
|
||||
|
||||
if (!PyArg_Parse(arg, "C:putwch", &unicode_char)) {
|
||||
goto exit;
|
||||
}
|
||||
return_value = msvcrt_putwch_impl(module, unicode_char);
|
||||
|
||||
exit:
|
||||
return return_value;
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(msvcrt_ungetch__doc__,
|
||||
"ungetch($module, char, /)\n"
|
||||
"--\n"
|
||||
"\n"
|
||||
"Opposite of getch.\n"
|
||||
"\n"
|
||||
"Cause the byte string char to be \"pushed back\" into the\n"
|
||||
"console buffer; it will be the next character read by\n"
|
||||
"getch() or getche().");
|
||||
|
||||
#define MSVCRT_UNGETCH_METHODDEF \
|
||||
{"ungetch", (PyCFunction)msvcrt_ungetch, METH_O, msvcrt_ungetch__doc__},
|
||||
|
||||
static PyObject *
|
||||
msvcrt_ungetch_impl(PyObject *module, char char_value);
|
||||
|
||||
static PyObject *
|
||||
msvcrt_ungetch(PyObject *module, PyObject *arg)
|
||||
{
|
||||
PyObject *return_value = NULL;
|
||||
char char_value;
|
||||
|
||||
if (!PyArg_Parse(arg, "c:ungetch", &char_value)) {
|
||||
goto exit;
|
||||
}
|
||||
return_value = msvcrt_ungetch_impl(module, char_value);
|
||||
|
||||
exit:
|
||||
return return_value;
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(msvcrt_ungetwch__doc__,
|
||||
"ungetwch($module, unicode_char, /)\n"
|
||||
"--\n"
|
||||
"\n"
|
||||
"Wide char variant of ungetch(), accepting a Unicode value.");
|
||||
|
||||
#define MSVCRT_UNGETWCH_METHODDEF \
|
||||
{"ungetwch", (PyCFunction)msvcrt_ungetwch, METH_O, msvcrt_ungetwch__doc__},
|
||||
|
||||
static PyObject *
|
||||
msvcrt_ungetwch_impl(PyObject *module, int unicode_char);
|
||||
|
||||
static PyObject *
|
||||
msvcrt_ungetwch(PyObject *module, PyObject *arg)
|
||||
{
|
||||
PyObject *return_value = NULL;
|
||||
int unicode_char;
|
||||
|
||||
if (!PyArg_Parse(arg, "C:ungetwch", &unicode_char)) {
|
||||
goto exit;
|
||||
}
|
||||
return_value = msvcrt_ungetwch_impl(module, unicode_char);
|
||||
|
||||
exit:
|
||||
return return_value;
|
||||
}
|
||||
|
||||
#if defined(_DEBUG)
|
||||
|
||||
PyDoc_STRVAR(msvcrt_CrtSetReportFile__doc__,
|
||||
"CrtSetReportFile($module, type, file, /)\n"
|
||||
"--\n"
|
||||
"\n"
|
||||
"Wrapper around _CrtSetReportFile.\n"
|
||||
"\n"
|
||||
"Only available on Debug builds.");
|
||||
|
||||
#define MSVCRT_CRTSETREPORTFILE_METHODDEF \
|
||||
{"CrtSetReportFile", (PyCFunction)msvcrt_CrtSetReportFile, METH_VARARGS, msvcrt_CrtSetReportFile__doc__},
|
||||
|
||||
static long
|
||||
msvcrt_CrtSetReportFile_impl(PyObject *module, int type, int file);
|
||||
|
||||
static PyObject *
|
||||
msvcrt_CrtSetReportFile(PyObject *module, PyObject *args)
|
||||
{
|
||||
PyObject *return_value = NULL;
|
||||
int type;
|
||||
int file;
|
||||
long _return_value;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "ii:CrtSetReportFile",
|
||||
&type, &file)) {
|
||||
goto exit;
|
||||
}
|
||||
_return_value = msvcrt_CrtSetReportFile_impl(module, type, file);
|
||||
if ((_return_value == -1) && PyErr_Occurred()) {
|
||||
goto exit;
|
||||
}
|
||||
return_value = PyLong_FromLong(_return_value);
|
||||
|
||||
exit:
|
||||
return return_value;
|
||||
}
|
||||
|
||||
#endif /* defined(_DEBUG) */
|
||||
|
||||
#if defined(_DEBUG)
|
||||
|
||||
PyDoc_STRVAR(msvcrt_CrtSetReportMode__doc__,
|
||||
"CrtSetReportMode($module, type, mode, /)\n"
|
||||
"--\n"
|
||||
"\n"
|
||||
"Wrapper around _CrtSetReportMode.\n"
|
||||
"\n"
|
||||
"Only available on Debug builds.");
|
||||
|
||||
#define MSVCRT_CRTSETREPORTMODE_METHODDEF \
|
||||
{"CrtSetReportMode", (PyCFunction)msvcrt_CrtSetReportMode, METH_VARARGS, msvcrt_CrtSetReportMode__doc__},
|
||||
|
||||
static long
|
||||
msvcrt_CrtSetReportMode_impl(PyObject *module, int type, int mode);
|
||||
|
||||
static PyObject *
|
||||
msvcrt_CrtSetReportMode(PyObject *module, PyObject *args)
|
||||
{
|
||||
PyObject *return_value = NULL;
|
||||
int type;
|
||||
int mode;
|
||||
long _return_value;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "ii:CrtSetReportMode",
|
||||
&type, &mode)) {
|
||||
goto exit;
|
||||
}
|
||||
_return_value = msvcrt_CrtSetReportMode_impl(module, type, mode);
|
||||
if ((_return_value == -1) && PyErr_Occurred()) {
|
||||
goto exit;
|
||||
}
|
||||
return_value = PyLong_FromLong(_return_value);
|
||||
|
||||
exit:
|
||||
return return_value;
|
||||
}
|
||||
|
||||
#endif /* defined(_DEBUG) */
|
||||
|
||||
#if defined(_DEBUG)
|
||||
|
||||
PyDoc_STRVAR(msvcrt_set_error_mode__doc__,
|
||||
"set_error_mode($module, mode, /)\n"
|
||||
"--\n"
|
||||
"\n"
|
||||
"Wrapper around _set_error_mode.\n"
|
||||
"\n"
|
||||
"Only available on Debug builds.");
|
||||
|
||||
#define MSVCRT_SET_ERROR_MODE_METHODDEF \
|
||||
{"set_error_mode", (PyCFunction)msvcrt_set_error_mode, METH_O, msvcrt_set_error_mode__doc__},
|
||||
|
||||
static long
|
||||
msvcrt_set_error_mode_impl(PyObject *module, int mode);
|
||||
|
||||
static PyObject *
|
||||
msvcrt_set_error_mode(PyObject *module, PyObject *arg)
|
||||
{
|
||||
PyObject *return_value = NULL;
|
||||
int mode;
|
||||
long _return_value;
|
||||
|
||||
if (!PyArg_Parse(arg, "i:set_error_mode", &mode)) {
|
||||
goto exit;
|
||||
}
|
||||
_return_value = msvcrt_set_error_mode_impl(module, mode);
|
||||
if ((_return_value == -1) && PyErr_Occurred()) {
|
||||
goto exit;
|
||||
}
|
||||
return_value = PyLong_FromLong(_return_value);
|
||||
|
||||
exit:
|
||||
return return_value;
|
||||
}
|
||||
|
||||
#endif /* defined(_DEBUG) */
|
||||
|
||||
PyDoc_STRVAR(msvcrt_SetErrorMode__doc__,
|
||||
"SetErrorMode($module, mode, /)\n"
|
||||
"--\n"
|
||||
"\n"
|
||||
"Wrapper around SetErrorMode.");
|
||||
|
||||
#define MSVCRT_SETERRORMODE_METHODDEF \
|
||||
{"SetErrorMode", (PyCFunction)msvcrt_SetErrorMode, METH_O, msvcrt_SetErrorMode__doc__},
|
||||
|
||||
static PyObject *
|
||||
msvcrt_SetErrorMode_impl(PyObject *module, unsigned int mode);
|
||||
|
||||
static PyObject *
|
||||
msvcrt_SetErrorMode(PyObject *module, PyObject *arg)
|
||||
{
|
||||
PyObject *return_value = NULL;
|
||||
unsigned int mode;
|
||||
|
||||
if (!PyArg_Parse(arg, "I:SetErrorMode", &mode)) {
|
||||
goto exit;
|
||||
}
|
||||
return_value = msvcrt_SetErrorMode_impl(module, mode);
|
||||
|
||||
exit:
|
||||
return return_value;
|
||||
}
|
||||
|
||||
#ifndef MSVCRT_CRTSETREPORTFILE_METHODDEF
|
||||
#define MSVCRT_CRTSETREPORTFILE_METHODDEF
|
||||
#endif /* !defined(MSVCRT_CRTSETREPORTFILE_METHODDEF) */
|
||||
|
||||
#ifndef MSVCRT_CRTSETREPORTMODE_METHODDEF
|
||||
#define MSVCRT_CRTSETREPORTMODE_METHODDEF
|
||||
#endif /* !defined(MSVCRT_CRTSETREPORTMODE_METHODDEF) */
|
||||
|
||||
#ifndef MSVCRT_SET_ERROR_MODE_METHODDEF
|
||||
#define MSVCRT_SET_ERROR_MODE_METHODDEF
|
||||
#endif /* !defined(MSVCRT_SET_ERROR_MODE_METHODDEF) */
|
||||
/*[clinic end generated code: output=ae04e2b50eef8b63 input=a9049054013a1b77]*/
|
3
third_party/python/PC/config.c
vendored
|
@ -1,9 +1,10 @@
|
|||
/* clang-format off */
|
||||
/* Module configuration */
|
||||
|
||||
/* This file contains the table of built-in modules.
|
||||
See create_builtin() in import.c. */
|
||||
|
||||
#include "Python.h"
|
||||
#include "third_party/python/Include/Python.h"
|
||||
|
||||
extern PyObject* PyInit_array(void);
|
||||
#ifndef MS_WINI64
|
||||
|
|
4
third_party/python/PC/dl_nt.c
vendored
|
@ -1,3 +1,4 @@
|
|||
/* clang-format off */
|
||||
/*
|
||||
|
||||
Entry point for the Windows NT DLL.
|
||||
|
@ -8,8 +9,7 @@ forgotten) from the programmer.
|
|||
|
||||
*/
|
||||
|
||||
#include "Python.h"
|
||||
#include "windows.h"
|
||||
#include "third_party/python/Include/Python.h"
|
||||
|
||||
#ifdef Py_ENABLE_SHARED
|
||||
#ifdef MS_DLL_ID
|
||||
|
|
77
third_party/python/PC/dllbase_nt.txt
vendored
|
@ -1,77 +0,0 @@
|
|||
In Win32, DLL's are "pre-linked" using a specified base address.
|
||||
When the DLL is loaded, an attempt is made to place it at
|
||||
that address. If that address is already in use, a new base address
|
||||
is selected, and the DLL subject to fixups. Apparently, these
|
||||
fixups are very slow, and significant performance gains can be
|
||||
made by selecting a good base address.
|
||||
|
||||
This document is to allocate base addresses to core Python
|
||||
and Python .PYD files, to give a better change of optimal performance.
|
||||
This base address is passed to the linker using the /BASE
|
||||
command line switch.
|
||||
|
||||
|
||||
Python.exe/Pythonw.exe - 1d000000 - 1e000000 (-1)
|
||||
Python.dll - 1e000000 - 1e100000 (-1)
|
||||
|
||||
Standard Extension Modules 1e100000 - 1e200000 ""
|
||||
- _symtable 1e100000 - 1e110000 pyd removed in 2.4
|
||||
- bsddb 1e180000 - 1e188000 pyd removed in 3.0
|
||||
- _tkinter 1e190000 - 1e1A0000
|
||||
- parser 1e1A0000 - 1e1B0000 pyd removed in 2.4
|
||||
- zlib 1e1B0000 - 1e1C0000
|
||||
- winreg 1e1C0000 - 1e1D0000 pyd removed in 2.4
|
||||
- _socket 1e1D0000 - 1e1E0000
|
||||
- _sre 1e1E0000 - 1e1F0000 pyd removed in 2.4
|
||||
- mmap 1e1F0000 - 1e1FFFFF pyd removed in 2.4
|
||||
|
||||
More standard extensions 1D100000 - 1e000000
|
||||
- pyexpat 1D100000 - 1D110000
|
||||
- select 1D110000 - 1D120000
|
||||
- unicodedata 1D120000 - 1D160000
|
||||
- winsound 1D160000 - 1D170000
|
||||
- bZ2 1D170000 - 1D180000
|
||||
- datetime 1D180000 - 1D190000 pyd removed in 2.4
|
||||
- _csv 1D190000 - 1D1A0000 pyd removed in 2.4
|
||||
- _ctypes 1D1A0000 - 1D1B0000
|
||||
|
||||
Other extension modules
|
||||
- win32api 1e200000 - 1e220000
|
||||
- win32ras 1e220000 - 1e230000
|
||||
- win32lz 1e230000 - 1e240000
|
||||
- timer 1e240000 - 1e250000
|
||||
- mmapfile 1e250000 - 1e260000
|
||||
- win32pipe 1e260000 - 1e270000
|
||||
- avl 1e270000 - 1e270000
|
||||
- dbhash 1e280000 - 1e290000
|
||||
- win32net 1e290000 - 1e2A0000
|
||||
- win32security 1e2A0000 - 1e2B0000
|
||||
- win32print 1e2B0000 - 1e2c0000
|
||||
- <unused> 1e2d0000 - 1e2e0000
|
||||
- win32gui 1e2e0000 - 1e2f0000
|
||||
- _imaging 1e2f0000 - 1e300000
|
||||
- multiarray 1e300000 - 1e310000
|
||||
- win32help 1e310000 - 1e320000
|
||||
- win32clipboard 1e320000 - 1e330000
|
||||
- win2kras 1e330000 - 1e340000
|
||||
- pythoncom 1e340000 - 1e400000
|
||||
- win32ui 1e400000 - 1e500000
|
||||
- win32uiole 1e500000 - 1e600000
|
||||
- pywintypes 1e600000 - 1e700000
|
||||
- win32process 1e700000 - 1e800000
|
||||
- odbc 1e710000 - 1e720000
|
||||
- dbi 1e720000 - 1e730000
|
||||
- win32file 1e730000 - 1e740000
|
||||
- win32wnet 1e740000 - 1e750000
|
||||
- win32com.shell 1e750000 - 1e760000
|
||||
- win32com.internet 1e760000 - 1e770000
|
||||
- win32com.exchange 1e770000 - 1e780000
|
||||
- win32com.exchdapi 1e780000 - 1e790000
|
||||
- win32com.axscript 1e790000 - 1e7a0000
|
||||
- win32com.axdebug 1e7b0000 - 1e7c0000
|
||||
- win32com.adsi 1e7f0000 - 1e800000
|
||||
- win32event 1e810000 - 1e820000
|
||||
- win32evtlog 1e820000 - 1e830000
|
||||
- win32com.axcontrol 1e830000 - 1e840000
|
||||
|
||||
|
6
third_party/python/PC/empty.c
vendored
|
@ -1,6 +0,0 @@
|
|||
#include <windows.h>
|
||||
int __stdcall
|
||||
WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
|
||||
{
|
||||
return 0;
|
||||
}
|
80
third_party/python/PC/errmap.h
vendored
|
@ -1,80 +0,0 @@
|
|||
/* Generated file. Do not edit. */
|
||||
int winerror_to_errno(int winerror)
|
||||
{
|
||||
switch(winerror) {
|
||||
case 2: return 2;
|
||||
case 3: return 2;
|
||||
case 4: return 24;
|
||||
case 5: return 13;
|
||||
case 6: return 9;
|
||||
case 7: return 12;
|
||||
case 8: return 12;
|
||||
case 9: return 12;
|
||||
case 10: return 7;
|
||||
case 11: return 8;
|
||||
case 15: return 2;
|
||||
case 16: return 13;
|
||||
case 17: return 18;
|
||||
case 18: return 2;
|
||||
case 19: return 13;
|
||||
case 20: return 13;
|
||||
case 21: return 13;
|
||||
case 22: return 13;
|
||||
case 23: return 13;
|
||||
case 24: return 13;
|
||||
case 25: return 13;
|
||||
case 26: return 13;
|
||||
case 27: return 13;
|
||||
case 28: return 13;
|
||||
case 29: return 13;
|
||||
case 30: return 13;
|
||||
case 31: return 13;
|
||||
case 32: return 13;
|
||||
case 33: return 13;
|
||||
case 34: return 13;
|
||||
case 35: return 13;
|
||||
case 36: return 13;
|
||||
case 53: return 2;
|
||||
case 65: return 13;
|
||||
case 67: return 2;
|
||||
case 80: return 17;
|
||||
case 82: return 13;
|
||||
case 83: return 13;
|
||||
case 89: return 11;
|
||||
case 108: return 13;
|
||||
case 109: return 32;
|
||||
case 112: return 28;
|
||||
case 114: return 9;
|
||||
case 128: return 10;
|
||||
case 129: return 10;
|
||||
case 130: return 9;
|
||||
case 132: return 13;
|
||||
case 145: return 41;
|
||||
case 158: return 13;
|
||||
case 161: return 2;
|
||||
case 164: return 11;
|
||||
case 167: return 13;
|
||||
case 183: return 17;
|
||||
case 188: return 8;
|
||||
case 189: return 8;
|
||||
case 190: return 8;
|
||||
case 191: return 8;
|
||||
case 192: return 8;
|
||||
case 193: return 8;
|
||||
case 194: return 8;
|
||||
case 195: return 8;
|
||||
case 196: return 8;
|
||||
case 197: return 8;
|
||||
case 198: return 8;
|
||||
case 199: return 8;
|
||||
case 200: return 8;
|
||||
case 201: return 8;
|
||||
case 202: return 8;
|
||||
case 206: return 2;
|
||||
case 215: return 11;
|
||||
case 232: return 32;
|
||||
case 267: return 20;
|
||||
case 1816: return 12;
|
||||
default: return EINVAL;
|
||||
}
|
||||
}
|
5
third_party/python/PC/errmap.mak
vendored
|
@ -1,5 +0,0 @@
|
|||
errmap.h: generrmap.exe
|
||||
.\generrmap.exe > errmap.h
|
||||
|
||||
genermap.exe: generrmap.c
|
||||
cl generrmap.c
|
3
third_party/python/PC/external/Externals.txt
vendored
|
@ -1,3 +0,0 @@
|
|||
The files in this folder are from the Microsoft.VisualStudio.Setup.Configuration.Native package on Nuget.
|
||||
|
||||
They are licensed under the MIT license.
|
|
@ -1,827 +0,0 @@
|
|||
// The MIT License(MIT)
|
||||
// Copyright(C) Microsoft Corporation.All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files(the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions :
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
// Constants
|
||||
//
|
||||
#ifndef E_NOTFOUND
|
||||
#define E_NOTFOUND HRESULT_FROM_WIN32(ERROR_NOT_FOUND)
|
||||
#endif
|
||||
|
||||
#ifndef E_FILENOTFOUND
|
||||
#define E_FILENOTFOUND HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND)
|
||||
#endif
|
||||
|
||||
#ifndef E_NOTSUPPORTED
|
||||
#define E_NOTSUPPORTED HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED)
|
||||
#endif
|
||||
|
||||
// Enumerations
|
||||
//
|
||||
/// <summary>
|
||||
/// The state of an instance.
|
||||
/// </summary>
|
||||
enum InstanceState
|
||||
{
|
||||
/// <summary>
|
||||
/// The instance state has not been determined.
|
||||
/// </summary>
|
||||
eNone = 0,
|
||||
|
||||
/// <summary>
|
||||
/// The instance installation path exists.
|
||||
/// </summary>
|
||||
eLocal = 1,
|
||||
|
||||
/// <summary>
|
||||
/// A product is registered to the instance.
|
||||
/// </summary>
|
||||
eRegistered = 2,
|
||||
|
||||
/// <summary>
|
||||
/// No reboot is required for the instance.
|
||||
/// </summary>
|
||||
eNoRebootRequired = 4,
|
||||
|
||||
/// <summary>
|
||||
/// No errors were reported for the instance.
|
||||
/// </summary>
|
||||
eNoErrors = 8,
|
||||
|
||||
/// <summary>
|
||||
/// The instance represents a complete install.
|
||||
/// </summary>
|
||||
eComplete = MAXUINT,
|
||||
};
|
||||
|
||||
// Forward interface declarations
|
||||
//
|
||||
#ifndef __ISetupInstance_FWD_DEFINED__
|
||||
#define __ISetupInstance_FWD_DEFINED__
|
||||
typedef struct ISetupInstance ISetupInstance;
|
||||
#endif
|
||||
|
||||
#ifndef __ISetupInstance2_FWD_DEFINED__
|
||||
#define __ISetupInstance2_FWD_DEFINED__
|
||||
typedef struct ISetupInstance2 ISetupInstance2;
|
||||
#endif
|
||||
|
||||
#ifndef __ISetupLocalizedProperties_FWD_DEFINED__
|
||||
#define __ISetupLocalizedProperties_FWD_DEFINED__
|
||||
typedef struct ISetupLocalizedProperties ISetupLocalizedProperties;
|
||||
#endif
|
||||
|
||||
#ifndef __IEnumSetupInstances_FWD_DEFINED__
|
||||
#define __IEnumSetupInstances_FWD_DEFINED__
|
||||
typedef struct IEnumSetupInstances IEnumSetupInstances;
|
||||
#endif
|
||||
|
||||
#ifndef __ISetupConfiguration_FWD_DEFINED__
|
||||
#define __ISetupConfiguration_FWD_DEFINED__
|
||||
typedef struct ISetupConfiguration ISetupConfiguration;
|
||||
#endif
|
||||
|
||||
#ifndef __ISetupConfiguration2_FWD_DEFINED__
|
||||
#define __ISetupConfiguration2_FWD_DEFINED__
|
||||
typedef struct ISetupConfiguration2 ISetupConfiguration2;
|
||||
#endif
|
||||
|
||||
#ifndef __ISetupPackageReference_FWD_DEFINED__
|
||||
#define __ISetupPackageReference_FWD_DEFINED__
|
||||
typedef struct ISetupPackageReference ISetupPackageReference;
|
||||
#endif
|
||||
|
||||
#ifndef __ISetupHelper_FWD_DEFINED__
|
||||
#define __ISetupHelper_FWD_DEFINED__
|
||||
typedef struct ISetupHelper ISetupHelper;
|
||||
#endif
|
||||
|
||||
#ifndef __ISetupErrorState_FWD_DEFINED__
|
||||
#define __ISetupErrorState_FWD_DEFINED__
|
||||
typedef struct ISetupErrorState ISetupErrorState;
|
||||
#endif
|
||||
|
||||
#ifndef __ISetupErrorState2_FWD_DEFINED__
|
||||
#define __ISetupErrorState2_FWD_DEFINED__
|
||||
typedef struct ISetupErrorState2 ISetupErrorState2;
|
||||
#endif
|
||||
|
||||
#ifndef __ISetupFailedPackageReference_FWD_DEFINED__
|
||||
#define __ISetupFailedPackageReference_FWD_DEFINED__
|
||||
typedef struct ISetupFailedPackageReference ISetupFailedPackageReference;
|
||||
#endif
|
||||
|
||||
#ifndef __ISetupFailedPackageReference2_FWD_DEFINED__
|
||||
#define __ISetupFailedPackageReference2_FWD_DEFINED__
|
||||
typedef struct ISetupFailedPackageReference2 ISetupFailedPackageReference2;
|
||||
#endif
|
||||
|
||||
#ifndef __ISetupPropertyStore_FWD_DEFINED__
|
||||
#define __ISetupPropertyStore_FWD_DEFINED__
|
||||
typedef struct ISetupPropertyStore ISetupPropertyStore;
|
||||
#endif
|
||||
|
||||
#ifndef __ISetupLocalizedPropertyStore_FWD_DEFINED__
|
||||
#define __ISetupLocalizedPropertyStore_FWD_DEFINED__
|
||||
typedef struct ISetupLocalizedPropertyStore ISetupLocalizedPropertyStore;
|
||||
#endif
|
||||
|
||||
// Forward class declarations
|
||||
//
|
||||
#ifndef __SetupConfiguration_FWD_DEFINED__
|
||||
#define __SetupConfiguration_FWD_DEFINED__
|
||||
|
||||
#ifdef __cplusplus
|
||||
typedef class SetupConfiguration SetupConfiguration;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// Interface definitions
|
||||
//
|
||||
EXTERN_C const IID IID_ISetupInstance;
|
||||
|
||||
#if defined(__cplusplus) && !defined(CINTERFACE)
|
||||
/// <summary>
|
||||
/// Information about an instance of a product.
|
||||
/// </summary>
|
||||
struct DECLSPEC_UUID("B41463C3-8866-43B5-BC33-2B0676F7F42E") DECLSPEC_NOVTABLE ISetupInstance : public IUnknown
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the instance identifier (should match the name of the parent instance directory).
|
||||
/// </summary>
|
||||
/// <param name="pbstrInstanceId">The instance identifier.</param>
|
||||
/// <returns>Standard HRESULT indicating success or failure, including E_FILENOTFOUND if the instance state does not exist.</returns>
|
||||
STDMETHOD(GetInstanceId)(
|
||||
_Out_ BSTR* pbstrInstanceId
|
||||
) = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the local date and time when the installation was originally installed.
|
||||
/// </summary>
|
||||
/// <param name="pInstallDate">The local date and time when the installation was originally installed.</param>
|
||||
/// <returns>Standard HRESULT indicating success or failure, including E_FILENOTFOUND if the instance state does not exist and E_NOTFOUND if the property is not defined.</returns>
|
||||
STDMETHOD(GetInstallDate)(
|
||||
_Out_ LPFILETIME pInstallDate
|
||||
) = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the unique name of the installation, often indicating the branch and other information used for telemetry.
|
||||
/// </summary>
|
||||
/// <param name="pbstrInstallationName">The unique name of the installation, often indicating the branch and other information used for telemetry.</param>
|
||||
/// <returns>Standard HRESULT indicating success or failure, including E_FILENOTFOUND if the instance state does not exist and E_NOTFOUND if the property is not defined.</returns>
|
||||
STDMETHOD(GetInstallationName)(
|
||||
_Out_ BSTR* pbstrInstallationName
|
||||
) = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the path to the installation root of the product.
|
||||
/// </summary>
|
||||
/// <param name="pbstrInstallationPath">The path to the installation root of the product.</param>
|
||||
/// <returns>Standard HRESULT indicating success or failure, including E_FILENOTFOUND if the instance state does not exist and E_NOTFOUND if the property is not defined.</returns>
|
||||
STDMETHOD(GetInstallationPath)(
|
||||
_Out_ BSTR* pbstrInstallationPath
|
||||
) = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the version of the product installed in this instance.
|
||||
/// </summary>
|
||||
/// <param name="pbstrInstallationVersion">The version of the product installed in this instance.</param>
|
||||
/// <returns>Standard HRESULT indicating success or failure, including E_FILENOTFOUND if the instance state does not exist and E_NOTFOUND if the property is not defined.</returns>
|
||||
STDMETHOD(GetInstallationVersion)(
|
||||
_Out_ BSTR* pbstrInstallationVersion
|
||||
) = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the display name (title) of the product installed in this instance.
|
||||
/// </summary>
|
||||
/// <param name="lcid">The LCID for the display name.</param>
|
||||
/// <param name="pbstrDisplayName">The display name (title) of the product installed in this instance.</param>
|
||||
/// <returns>Standard HRESULT indicating success or failure, including E_FILENOTFOUND if the instance state does not exist and E_NOTFOUND if the property is not defined.</returns>
|
||||
STDMETHOD(GetDisplayName)(
|
||||
_In_ LCID lcid,
|
||||
_Out_ BSTR* pbstrDisplayName
|
||||
) = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the description of the product installed in this instance.
|
||||
/// </summary>
|
||||
/// <param name="lcid">The LCID for the description.</param>
|
||||
/// <param name="pbstrDescription">The description of the product installed in this instance.</param>
|
||||
/// <returns>Standard HRESULT indicating success or failure, including E_FILENOTFOUND if the instance state does not exist and E_NOTFOUND if the property is not defined.</returns>
|
||||
STDMETHOD(GetDescription)(
|
||||
_In_ LCID lcid,
|
||||
_Out_ BSTR* pbstrDescription
|
||||
) = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Resolves the optional relative path to the root path of the instance.
|
||||
/// </summary>
|
||||
/// <param name="pwszRelativePath">A relative path within the instance to resolve, or NULL to get the root path.</param>
|
||||
/// <param name="pbstrAbsolutePath">The full path to the optional relative path within the instance. If the relative path is NULL, the root path will always terminate in a backslash.</param>
|
||||
/// <returns>Standard HRESULT indicating success or failure, including E_FILENOTFOUND if the instance state does not exist and E_NOTFOUND if the property is not defined.</returns>
|
||||
STDMETHOD(ResolvePath)(
|
||||
_In_opt_z_ LPCOLESTR pwszRelativePath,
|
||||
_Out_ BSTR* pbstrAbsolutePath
|
||||
) = 0;
|
||||
};
|
||||
#endif
|
||||
|
||||
EXTERN_C const IID IID_ISetupInstance2;
|
||||
|
||||
#if defined(__cplusplus) && !defined(CINTERFACE)
|
||||
/// <summary>
|
||||
/// Information about an instance of a product.
|
||||
/// </summary>
|
||||
struct DECLSPEC_UUID("89143C9A-05AF-49B0-B717-72E218A2185C") DECLSPEC_NOVTABLE ISetupInstance2 : public ISetupInstance
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the state of the instance.
|
||||
/// </summary>
|
||||
/// <param name="pState">The state of the instance.</param>
|
||||
/// <returns>Standard HRESULT indicating success or failure, including E_FILENOTFOUND if the instance state does not exist.</returns>
|
||||
STDMETHOD(GetState)(
|
||||
_Out_ InstanceState* pState
|
||||
) = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Gets an array of package references registered to the instance.
|
||||
/// </summary>
|
||||
/// <param name="ppsaPackages">Pointer to an array of <see cref="ISetupPackageReference"/>.</param>
|
||||
/// <returns>Standard HRESULT indicating success or failure, including E_FILENOTFOUND if the instance state does not exist and E_NOTFOUND if the packages property is not defined.</returns>
|
||||
STDMETHOD(GetPackages)(
|
||||
_Out_ LPSAFEARRAY* ppsaPackages
|
||||
) = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a pointer to the <see cref="ISetupPackageReference"/> that represents the registered product.
|
||||
/// </summary>
|
||||
/// <param name="ppPackage">Pointer to an instance of <see cref="ISetupPackageReference"/>. This may be NULL if <see cref="GetState"/> does not return <see cref="eComplete"/>.</param>
|
||||
/// <returns>Standard HRESULT indicating success or failure, including E_FILENOTFOUND if the instance state does not exist and E_NOTFOUND if the packages property is not defined.</returns>
|
||||
STDMETHOD(GetProduct)(
|
||||
_Outptr_result_maybenull_ ISetupPackageReference** ppPackage
|
||||
) = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the relative path to the product application, if available.
|
||||
/// </summary>
|
||||
/// <param name="pbstrProductPath">The relative path to the product application, if available.</param>
|
||||
/// <returns>Standard HRESULT indicating success or failure, including E_FILENOTFOUND if the instance state does not exist.</returns>
|
||||
STDMETHOD(GetProductPath)(
|
||||
_Outptr_result_maybenull_ BSTR* pbstrProductPath
|
||||
) = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the error state of the instance, if available.
|
||||
/// </summary>
|
||||
/// <param name="pErrorState">The error state of the instance, if available.</param>
|
||||
/// <returns>Standard HRESULT indicating success or failure, including E_FILENOTFOUND if the instance state does not exist.</returns>
|
||||
STDMETHOD(GetErrors)(
|
||||
_Outptr_result_maybenull_ ISetupErrorState** ppErrorState
|
||||
) = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether the instance can be launched.
|
||||
/// </summary>
|
||||
/// <param name="pfIsLaunchable">Whether the instance can be launched.</param>
|
||||
/// <returns>Standard HRESULT indicating success or failure.</returns>
|
||||
/// <remarks>
|
||||
/// An instance could have had errors during install but still be launched. Some features may not work correctly, but others will.
|
||||
/// </remarks>
|
||||
STDMETHOD(IsLaunchable)(
|
||||
_Out_ VARIANT_BOOL* pfIsLaunchable
|
||||
) = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether the instance is complete.
|
||||
/// </summary>
|
||||
/// <param name="pfIsLaunchable">Whether the instance is complete.</param>
|
||||
/// <returns>Standard HRESULT indicating success or failure.</returns>
|
||||
/// <remarks>
|
||||
/// An instance is complete if it had no errors during install, resume, or repair.
|
||||
/// </remarks>
|
||||
STDMETHOD(IsComplete)(
|
||||
_Out_ VARIANT_BOOL* pfIsComplete
|
||||
) = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Gets product-specific properties.
|
||||
/// </summary>
|
||||
/// <param name="ppPropeties">A pointer to an instance of <see cref="ISetupPropertyStore"/>. This may be NULL if no properties are defined.</param>
|
||||
/// <returns>Standard HRESULT indicating success or failure, including E_FILENOTFOUND if the instance state does not exist.</returns>
|
||||
STDMETHOD(GetProperties)(
|
||||
_Outptr_result_maybenull_ ISetupPropertyStore** ppProperties
|
||||
) = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the directory path to the setup engine that installed the instance.
|
||||
/// </summary>
|
||||
/// <param name="pbstrEnginePath">The directory path to the setup engine that installed the instance.</param>
|
||||
/// <returns>Standard HRESULT indicating success or failure, including E_FILENOTFOUND if the instance state does not exist.</returns>
|
||||
STDMETHOD(GetEnginePath)(
|
||||
_Outptr_result_maybenull_ BSTR* pbstrEnginePath
|
||||
) = 0;
|
||||
};
|
||||
#endif
|
||||
|
||||
EXTERN_C const IID IID_ISetupLocalizedProperties;
|
||||
|
||||
#if defined(__cplusplus) && !defined(CINTERFACE)
|
||||
/// <summary>
|
||||
/// Provides localized properties of an instance of a product.
|
||||
/// </summary>
|
||||
struct DECLSPEC_UUID("F4BD7382-FE27-4AB4-B974-9905B2A148B0") DECLSPEC_NOVTABLE ISetupLocalizedProperties : public IUnknown
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets localized product-specific properties.
|
||||
/// </summary>
|
||||
/// <param name="ppLocalizedProperties">A pointer to an instance of <see cref="ISetupLocalizedPropertyStore"/>. This may be NULL if no properties are defined.</param>
|
||||
/// <returns>Standard HRESULT indicating success or failure.</returns>
|
||||
STDMETHOD(GetLocalizedProperties)(
|
||||
_Outptr_result_maybenull_ ISetupLocalizedPropertyStore** ppLocalizedProperties
|
||||
) = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Gets localized channel-specific properties.
|
||||
/// </summary>
|
||||
/// <param name="ppLocalizedChannelProperties">A pointer to an instance of <see cref="ISetupLocalizedPropertyStore"/>. This may be NULL if no channel properties are defined.</param>
|
||||
/// <returns>Standard HRESULT indicating success or failure.</returns>
|
||||
STDMETHOD(GetLocalizedChannelProperties)(
|
||||
_Outptr_result_maybenull_ ISetupLocalizedPropertyStore** ppLocalizedChannelProperties
|
||||
) = 0;
|
||||
};
|
||||
#endif
|
||||
|
||||
EXTERN_C const IID IID_IEnumSetupInstances;
|
||||
|
||||
#if defined(__cplusplus) && !defined(CINTERFACE)
|
||||
/// <summary>
|
||||
/// An enumerator of installed <see cref="ISetupInstance"/> objects.
|
||||
/// </summary>
|
||||
struct DECLSPEC_UUID("6380BCFF-41D3-4B2E-8B2E-BF8A6810C848") DECLSPEC_NOVTABLE IEnumSetupInstances : public IUnknown
|
||||
{
|
||||
/// <summary>
|
||||
/// Retrieves the next set of product instances in the enumeration sequence.
|
||||
/// </summary>
|
||||
/// <param name="celt">The number of product instances to retrieve.</param>
|
||||
/// <param name="rgelt">A pointer to an array of <see cref="ISetupInstance"/>.</param>
|
||||
/// <param name="pceltFetched">A pointer to the number of product instances retrieved. If <paramref name="celt"/> is 1 this parameter may be NULL.</param>
|
||||
/// <returns>S_OK if the number of elements were fetched, S_FALSE if nothing was fetched (at end of enumeration), E_INVALIDARG if <paramref name="celt"/> is greater than 1 and pceltFetched is NULL, or E_OUTOFMEMORY if an <see cref="ISetupInstance"/> could not be allocated.</returns>
|
||||
STDMETHOD(Next)(
|
||||
_In_ ULONG celt,
|
||||
_Out_writes_to_(celt, *pceltFetched) ISetupInstance** rgelt,
|
||||
_Out_opt_ _Deref_out_range_(0, celt) ULONG* pceltFetched
|
||||
) = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Skips the next set of product instances in the enumeration sequence.
|
||||
/// </summary>
|
||||
/// <param name="celt">The number of product instances to skip.</param>
|
||||
/// <returns>S_OK if the number of elements could be skipped; otherwise, S_FALSE;</returns>
|
||||
STDMETHOD(Skip)(
|
||||
_In_ ULONG celt
|
||||
) = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Resets the enumeration sequence to the beginning.
|
||||
/// </summary>
|
||||
/// <returns>Always returns S_OK;</returns>
|
||||
STDMETHOD(Reset)(void) = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new enumeration object in the same state as the current enumeration object: the new object points to the same place in the enumeration sequence.
|
||||
/// </summary>
|
||||
/// <param name="ppenum">A pointer to a pointer to a new <see cref="IEnumSetupInstances"/> interface. If the method fails, this parameter is undefined.</param>
|
||||
/// <returns>S_OK if a clone was returned; otherwise, E_OUTOFMEMORY.</returns>
|
||||
STDMETHOD(Clone)(
|
||||
_Deref_out_opt_ IEnumSetupInstances** ppenum
|
||||
) = 0;
|
||||
};
|
||||
#endif
|
||||
|
||||
EXTERN_C const IID IID_ISetupConfiguration;
|
||||
|
||||
#if defined(__cplusplus) && !defined(CINTERFACE)
|
||||
/// <summary>
|
||||
/// Gets information about product instances installed on the machine.
|
||||
/// </summary>
|
||||
struct DECLSPEC_UUID("42843719-DB4C-46C2-8E7C-64F1816EFD5B") DECLSPEC_NOVTABLE ISetupConfiguration : public IUnknown
|
||||
{
|
||||
/// <summary>
|
||||
/// Enumerates all launchable product instances installed.
|
||||
/// </summary>
|
||||
/// <param name="ppEnumInstances">An enumeration of completed, installed product instances.</param>
|
||||
/// <returns>Standard HRESULT indicating success or failure.</returns>
|
||||
STDMETHOD(EnumInstances)(
|
||||
_Out_ IEnumSetupInstances** ppEnumInstances
|
||||
) = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the instance for the current process path.
|
||||
/// </summary>
|
||||
/// <param name="ppInstance">The instance for the current process path.</param>
|
||||
/// <returns>
|
||||
/// The instance for the current process path, or E_NOTFOUND if not found.
|
||||
/// The <see cref="ISetupInstance::GetState"/> may indicate the instance is invalid.
|
||||
/// </returns>
|
||||
/// <remarks>
|
||||
/// The returned instance may not be launchable.
|
||||
/// </remarks>
|
||||
STDMETHOD(GetInstanceForCurrentProcess)(
|
||||
_Out_ ISetupInstance** ppInstance
|
||||
) = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the instance for the given path.
|
||||
/// </summary>
|
||||
/// <param name="ppInstance">The instance for the given path.</param>
|
||||
/// <returns>
|
||||
/// The instance for the given path, or E_NOTFOUND if not found.
|
||||
/// The <see cref="ISetupInstance::GetState"/> may indicate the instance is invalid.
|
||||
/// </returns>
|
||||
/// <remarks>
|
||||
/// The returned instance may not be launchable.
|
||||
/// </remarks>
|
||||
STDMETHOD(GetInstanceForPath)(
|
||||
_In_z_ LPCWSTR wzPath,
|
||||
_Out_ ISetupInstance** ppInstance
|
||||
) = 0;
|
||||
};
|
||||
#endif
|
||||
|
||||
EXTERN_C const IID IID_ISetupConfiguration2;
|
||||
|
||||
#if defined(__cplusplus) && !defined(CINTERFACE)
|
||||
/// <summary>
|
||||
/// Gets information about product instances.
|
||||
/// </summary>
|
||||
struct DECLSPEC_UUID("26AAB78C-4A60-49D6-AF3B-3C35BC93365D") DECLSPEC_NOVTABLE ISetupConfiguration2 : public ISetupConfiguration
|
||||
{
|
||||
/// <summary>
|
||||
/// Enumerates all product instances.
|
||||
/// </summary>
|
||||
/// <param name="ppEnumInstances">An enumeration of all product instances.</param>
|
||||
/// <returns>Standard HRESULT indicating success or failure.</returns>
|
||||
STDMETHOD(EnumAllInstances)(
|
||||
_Out_ IEnumSetupInstances** ppEnumInstances
|
||||
) = 0;
|
||||
};
|
||||
#endif
|
||||
|
||||
EXTERN_C const IID IID_ISetupPackageReference;
|
||||
|
||||
#if defined(__cplusplus) && !defined(CINTERFACE)
|
||||
/// <summary>
|
||||
/// A reference to a package.
|
||||
/// </summary>
|
||||
struct DECLSPEC_UUID("da8d8a16-b2b6-4487-a2f1-594ccccd6bf5") DECLSPEC_NOVTABLE ISetupPackageReference : public IUnknown
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the general package identifier.
|
||||
/// </summary>
|
||||
/// <param name="pbstrId">The general package identifier.</param>
|
||||
/// <returns>Standard HRESULT indicating success or failure.</returns>
|
||||
STDMETHOD(GetId)(
|
||||
_Out_ BSTR* pbstrId
|
||||
) = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the version of the package.
|
||||
/// </summary>
|
||||
/// <param name="pbstrVersion">The version of the package.</param>
|
||||
/// <returns>Standard HRESULT indicating success or failure.</returns>
|
||||
STDMETHOD(GetVersion)(
|
||||
_Out_ BSTR* pbstrVersion
|
||||
) = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the target process architecture of the package.
|
||||
/// </summary>
|
||||
/// <param name="pbstrChip">The target process architecture of the package.</param>
|
||||
/// <returns>Standard HRESULT indicating success or failure.</returns>
|
||||
STDMETHOD(GetChip)(
|
||||
_Out_ BSTR* pbstrChip
|
||||
) = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the language and optional region identifier.
|
||||
/// </summary>
|
||||
/// <param name="pbstrLanguage">The language and optional region identifier.</param>
|
||||
/// <returns>Standard HRESULT indicating success or failure.</returns>
|
||||
STDMETHOD(GetLanguage)(
|
||||
_Out_ BSTR* pbstrLanguage
|
||||
) = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the build branch of the package.
|
||||
/// </summary>
|
||||
/// <param name="pbstrBranch">The build branch of the package.</param>
|
||||
/// <returns>Standard HRESULT indicating success or failure.</returns>
|
||||
STDMETHOD(GetBranch)(
|
||||
_Out_ BSTR* pbstrBranch
|
||||
) = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the type of the package.
|
||||
/// </summary>
|
||||
/// <param name="pbstrType">The type of the package.</param>
|
||||
/// <returns>Standard HRESULT indicating success or failure.</returns>
|
||||
STDMETHOD(GetType)(
|
||||
_Out_ BSTR* pbstrType
|
||||
) = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the unique identifier consisting of all defined tokens.
|
||||
/// </summary>
|
||||
/// <param name="pbstrUniqueId">The unique identifier consisting of all defined tokens.</param>
|
||||
/// <returns>Standard HRESULT indicating success or failure, including E_UNEXPECTED if no Id was defined (required).</returns>
|
||||
STDMETHOD(GetUniqueId)(
|
||||
_Out_ BSTR* pbstrUniqueId
|
||||
) = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether the package refers to an external extension.
|
||||
/// </summary>
|
||||
/// <param name="pfIsExtension">A value indicating whether the package refers to an external extension.</param>
|
||||
/// <returns>Standard HRESULT indicating success or failure, including E_UNEXPECTED if no Id was defined (required).</returns>
|
||||
STDMETHOD(GetIsExtension)(
|
||||
_Out_ VARIANT_BOOL* pfIsExtension
|
||||
) = 0;
|
||||
};
|
||||
#endif
|
||||
|
||||
EXTERN_C const IID IID_ISetupHelper;
|
||||
|
||||
#if defined(__cplusplus) && !defined(CINTERFACE)
|
||||
/// <summary>
|
||||
/// Helper functions.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// You can query for this interface from the <see cref="SetupConfiguration"/> class.
|
||||
/// </remarks>
|
||||
struct DECLSPEC_UUID("42b21b78-6192-463e-87bf-d577838f1d5c") DECLSPEC_NOVTABLE ISetupHelper : public IUnknown
|
||||
{
|
||||
/// <summary>
|
||||
/// Parses a dotted quad version string into a 64-bit unsigned integer.
|
||||
/// </summary>
|
||||
/// <param name="pwszVersion">The dotted quad version string to parse, e.g. 1.2.3.4.</param>
|
||||
/// <param name="pullVersion">A 64-bit unsigned integer representing the version. You can compare this to other versions.</param>
|
||||
/// <returns>Standard HRESULT indicating success or failure, including E_INVALIDARG if the version is not valid.</returns>
|
||||
STDMETHOD(ParseVersion)(
|
||||
_In_ LPCOLESTR pwszVersion,
|
||||
_Out_ PULONGLONG pullVersion
|
||||
) = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Parses a dotted quad version string into a 64-bit unsigned integer.
|
||||
/// </summary>
|
||||
/// <param name="pwszVersionRange">The string containing 1 or 2 dotted quad version strings to parse, e.g. [1.0,) that means 1.0.0.0 or newer.</param>
|
||||
/// <param name="pullMinVersion">A 64-bit unsigned integer representing the minimum version, which may be 0. You can compare this to other versions.</param>
|
||||
/// <param name="pullMaxVersion">A 64-bit unsigned integer representing the maximum version, which may be MAXULONGLONG. You can compare this to other versions.</param>
|
||||
/// <returns>Standard HRESULT indicating success or failure, including E_INVALIDARG if the version range is not valid.</returns>
|
||||
STDMETHOD(ParseVersionRange)(
|
||||
_In_ LPCOLESTR pwszVersionRange,
|
||||
_Out_ PULONGLONG pullMinVersion,
|
||||
_Out_ PULONGLONG pullMaxVersion
|
||||
) = 0;
|
||||
};
|
||||
#endif
|
||||
|
||||
EXTERN_C const IID IID_ISetupErrorState;
|
||||
|
||||
#if defined(__cplusplus) && !defined(CINTERFACE)
|
||||
/// <summary>
|
||||
/// Information about the error state of an instance.
|
||||
/// </summary>
|
||||
struct DECLSPEC_UUID("46DCCD94-A287-476A-851E-DFBC2FFDBC20") DECLSPEC_NOVTABLE ISetupErrorState : public IUnknown
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets an array of failed package references.
|
||||
/// </summary>
|
||||
/// <param name="ppsaPackages">Pointer to an array of <see cref="ISetupFailedPackageReference"/>, if packages have failed.</param>
|
||||
/// <returns>Standard HRESULT indicating success or failure.</returns>
|
||||
STDMETHOD(GetFailedPackages)(
|
||||
_Outptr_result_maybenull_ LPSAFEARRAY* ppsaFailedPackages
|
||||
) = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Gets an array of skipped package references.
|
||||
/// </summary>
|
||||
/// <param name="ppsaPackages">Pointer to an array of <see cref="ISetupPackageReference"/>, if packages have been skipped.</param>
|
||||
/// <returns>Standard HRESULT indicating success or failure.</returns>
|
||||
STDMETHOD(GetSkippedPackages)(
|
||||
_Outptr_result_maybenull_ LPSAFEARRAY* ppsaSkippedPackages
|
||||
) = 0;
|
||||
};
|
||||
#endif
|
||||
|
||||
EXTERN_C const IID IID_ISetupErrorState2;
|
||||
|
||||
#if defined(__cplusplus) && !defined(CINTERFACE)
|
||||
/// <summary>
|
||||
/// Information about the error state of an instance.
|
||||
/// </summary>
|
||||
struct DECLSPEC_UUID("9871385B-CA69-48F2-BC1F-7A37CBF0B1EF") DECLSPEC_NOVTABLE ISetupErrorState2 : public ISetupErrorState
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the path to the error log.
|
||||
/// </summary>
|
||||
/// <param name="pbstrChip">The path to the error log.</param>
|
||||
/// <returns>Standard HRESULT indicating success or failure.</returns>
|
||||
STDMETHOD(GetErrorLogFilePath)(
|
||||
_Outptr_result_maybenull_ BSTR* pbstrErrorLogFilePath
|
||||
) = 0;
|
||||
};
|
||||
#endif
|
||||
|
||||
EXTERN_C const IID IID_ISetupFailedPackageReference;
|
||||
|
||||
#if defined(__cplusplus) && !defined(CINTERFACE)
|
||||
/// <summary>
|
||||
/// A reference to a failed package.
|
||||
/// </summary>
|
||||
struct DECLSPEC_UUID("E73559CD-7003-4022-B134-27DC650B280F") DECLSPEC_NOVTABLE ISetupFailedPackageReference : public ISetupPackageReference
|
||||
{
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
EXTERN_C const IID IID_ISetupFailedPackageReference2;
|
||||
|
||||
#if defined(__cplusplus) && !defined(CINTERFACE)
|
||||
/// <summary>
|
||||
/// A reference to a failed package.
|
||||
/// </summary>
|
||||
struct DECLSPEC_UUID("0FAD873E-E874-42E3-B268-4FE2F096B9CA") DECLSPEC_NOVTABLE ISetupFailedPackageReference2 : public ISetupFailedPackageReference
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the path to the optional package log.
|
||||
/// </summary>
|
||||
/// <param name="pbstrId">The path to the optional package log.</param>
|
||||
/// <returns>Standard HRESULT indicating success or failure.</returns>
|
||||
STDMETHOD(GetLogFilePath)(
|
||||
_Outptr_result_maybenull_ BSTR* pbstrLogFilePath
|
||||
) = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the description of the package failure.
|
||||
/// </summary>
|
||||
/// <param name="pbstrId">The description of the package failure.</param>
|
||||
/// <returns>Standard HRESULT indicating success or failure.</returns>
|
||||
STDMETHOD(GetDescription)(
|
||||
_Outptr_result_maybenull_ BSTR* pbstrDescription
|
||||
) = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the signature to use for feedback reporting.
|
||||
/// </summary>
|
||||
/// <param name="pbstrId">The signature to use for feedback reporting.</param>
|
||||
/// <returns>Standard HRESULT indicating success or failure.</returns>
|
||||
STDMETHOD(GetSignature)(
|
||||
_Outptr_result_maybenull_ BSTR* pbstrSignature
|
||||
) = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the array of details for this package failure.
|
||||
/// </summary>
|
||||
/// <param name="ppsaDetails">Pointer to an array of details as BSTRs.</param>
|
||||
/// <returns>Standard HRESULT indicating success or failure.</returns>
|
||||
STDMETHOD(GetDetails)(
|
||||
_Out_ LPSAFEARRAY* ppsaDetails
|
||||
) = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Gets an array of packages affected by this package failure.
|
||||
/// </summary>
|
||||
/// <param name="ppsaPackages">Pointer to an array of <see cref="ISetupPackageReference"/> for packages affected by this package failure. This may be NULL.</param>
|
||||
/// <returns>Standard HRESULT indicating success or failure.</returns>
|
||||
STDMETHOD(GetAffectedPackages)(
|
||||
_Out_ LPSAFEARRAY* ppsaAffectedPackages
|
||||
) = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
EXTERN_C const IID IID_ISetupPropertyStore;
|
||||
|
||||
#if defined(__cplusplus) && !defined(CINTERFACE)
|
||||
/// <summary>
|
||||
/// Provides named properties.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// You can get this from an <see cref="ISetupInstance"/>, <see cref="ISetupPackageReference"/>, or derivative.
|
||||
/// </remarks>
|
||||
struct DECLSPEC_UUID("C601C175-A3BE-44BC-91F6-4568D230FC83") DECLSPEC_NOVTABLE ISetupPropertyStore : public IUnknown
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets an array of property names in this property store.
|
||||
/// </summary>
|
||||
/// <param name="ppsaNames">Pointer to an array of property names as BSTRs.</param>
|
||||
/// <returns>Standard HRESULT indicating success or failure.</returns>
|
||||
STDMETHOD(GetNames)(
|
||||
_Out_ LPSAFEARRAY* ppsaNames
|
||||
) = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the value of a named property in this property store.
|
||||
/// </summary>
|
||||
/// <param name="pwszName">The name of the property to get.</param>
|
||||
/// <param name="pvtValue">The value of the property.</param>
|
||||
/// <returns>Standard HRESULT indicating success or failure, including E_NOTFOUND if the property is not defined or E_NOTSUPPORTED if the property type is not supported.</returns>
|
||||
STDMETHOD(GetValue)(
|
||||
_In_ LPCOLESTR pwszName,
|
||||
_Out_ LPVARIANT pvtValue
|
||||
) = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
EXTERN_C const IID IID_ISetupLocalizedPropertyStore;
|
||||
|
||||
#if defined(__cplusplus) && !defined(CINTERFACE)
|
||||
/// <summary>
|
||||
/// Provides localized named properties.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// You can get this from an <see cref="ISetupLocalizedProperties"/>.
|
||||
/// </remarks>
|
||||
struct DECLSPEC_UUID("5BB53126-E0D5-43DF-80F1-6B161E5C6F6C") DECLSPEC_NOVTABLE ISetupLocalizedPropertyStore : public IUnknown
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets an array of property names in this property store.
|
||||
/// </summary>
|
||||
/// <param name="lcid">The LCID for the property names.</param>
|
||||
/// <param name="ppsaNames">Pointer to an array of property names as BSTRs.</param>
|
||||
/// <returns>Standard HRESULT indicating success or failure.</returns>
|
||||
STDMETHOD(GetNames)(
|
||||
_In_ LCID lcid,
|
||||
_Out_ LPSAFEARRAY* ppsaNames
|
||||
) = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the value of a named property in this property store.
|
||||
/// </summary>
|
||||
/// <param name="pwszName">The name of the property to get.</param>
|
||||
/// <param name="lcid">The LCID for the property.</param>
|
||||
/// <param name="pvtValue">The value of the property.</param>
|
||||
/// <returns>Standard HRESULT indicating success or failure, including E_NOTFOUND if the property is not defined or E_NOTSUPPORTED if the property type is not supported.</returns>
|
||||
STDMETHOD(GetValue)(
|
||||
_In_ LPCOLESTR pwszName,
|
||||
_In_ LCID lcid,
|
||||
_Out_ LPVARIANT pvtValue
|
||||
) = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
// Class declarations
|
||||
//
|
||||
EXTERN_C const CLSID CLSID_SetupConfiguration;
|
||||
|
||||
#ifdef __cplusplus
|
||||
/// <summary>
|
||||
/// This class implements <see cref="ISetupConfiguration"/>, <see cref="ISetupConfiguration2"/>, and <see cref="ISetupHelper"/>.
|
||||
/// </summary>
|
||||
class DECLSPEC_UUID("177F0C4A-1CD3-4DE7-A32C-71DBBB9FA36D") SetupConfiguration;
|
||||
#endif
|
||||
|
||||
// Function declarations
|
||||
//
|
||||
/// <summary>
|
||||
/// Gets an <see cref="ISetupConfiguration"/> that provides information about product instances installed on the machine.
|
||||
/// </summary>
|
||||
/// <param name="ppConfiguration">The <see cref="ISetupConfiguration"/> that provides information about product instances installed on the machine.</param>
|
||||
/// <param name="pReserved">Reserved for future use.</param>
|
||||
/// <returns>Standard HRESULT indicating success or failure.</returns>
|
||||
STDMETHODIMP GetSetupConfiguration(
|
||||
_Out_ ISetupConfiguration** ppConfiguration,
|
||||
_Reserved_ LPVOID pReserved
|
||||
);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
115
third_party/python/PC/frozen_dllmain.c
vendored
|
@ -44,7 +44,6 @@ changed, here is a snippet from the pythoncom extension module.
|
|||
// end of example code from pythoncom's DllMain.cpp
|
||||
|
||||
***************************************************************************/
|
||||
#include "windows.h"
|
||||
|
||||
static char *possibleModules[] = {
|
||||
"pywintypes",
|
||||
|
@ -55,80 +54,70 @@ static char *possibleModules[] = {
|
|||
|
||||
BOOL CallModuleDllMain(char *modName, DWORD dwReason);
|
||||
|
||||
|
||||
/*
|
||||
Called by a frozen .EXE only, so that built-in extension
|
||||
modules are initialized correctly
|
||||
*/
|
||||
void PyWinFreeze_ExeInit(void)
|
||||
{
|
||||
char **modName;
|
||||
for (modName = possibleModules;*modName;*modName++) {
|
||||
/* printf("Initialising '%s'\n", *modName); */
|
||||
CallModuleDllMain(*modName, DLL_PROCESS_ATTACH);
|
||||
}
|
||||
void PyWinFreeze_ExeInit(void) {
|
||||
char **modName;
|
||||
for (modName = possibleModules; *modName; *modName++) {
|
||||
/* printf("Initialising '%s'\n", *modName); */
|
||||
CallModuleDllMain(*modName, DLL_PROCESS_ATTACH);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Called by a frozen .EXE only, so that built-in extension
|
||||
modules are cleaned up
|
||||
*/
|
||||
void PyWinFreeze_ExeTerm(void)
|
||||
{
|
||||
// Must go backwards
|
||||
char **modName;
|
||||
for (modName = possibleModules+Py_ARRAY_LENGTH(possibleModules)-2;
|
||||
modName >= possibleModules;
|
||||
*modName--) {
|
||||
/* printf("Terminating '%s'\n", *modName);*/
|
||||
void PyWinFreeze_ExeTerm(void) {
|
||||
// Must go backwards
|
||||
char **modName;
|
||||
for (modName = possibleModules + Py_ARRAY_LENGTH(possibleModules) - 2;
|
||||
modName >= possibleModules; *modName--) {
|
||||
/* printf("Terminating '%s'\n", *modName);*/
|
||||
CallModuleDllMain(*modName, DLL_PROCESS_DETACH);
|
||||
}
|
||||
}
|
||||
|
||||
BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved) {
|
||||
BOOL ret = TRUE;
|
||||
switch (dwReason) {
|
||||
case DLL_PROCESS_ATTACH: {
|
||||
char **modName;
|
||||
for (modName = possibleModules; *modName; *modName++) {
|
||||
BOOL ok = CallModuleDllMain(*modName, dwReason);
|
||||
if (!ok) ret = FALSE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case DLL_PROCESS_DETACH: {
|
||||
// Must go backwards
|
||||
char **modName;
|
||||
for (modName = possibleModules + Py_ARRAY_LENGTH(possibleModules) - 2;
|
||||
modName >= possibleModules; *modName--)
|
||||
CallModuleDllMain(*modName, DLL_PROCESS_DETACH);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
|
||||
{
|
||||
BOOL ret = TRUE;
|
||||
switch (dwReason) {
|
||||
case DLL_PROCESS_ATTACH:
|
||||
{
|
||||
char **modName;
|
||||
for (modName = possibleModules;*modName;*modName++) {
|
||||
BOOL ok = CallModuleDllMain(*modName, dwReason);
|
||||
if (!ok)
|
||||
ret = FALSE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case DLL_PROCESS_DETACH:
|
||||
{
|
||||
// Must go backwards
|
||||
char **modName;
|
||||
for (modName = possibleModules+Py_ARRAY_LENGTH(possibleModules)-2;
|
||||
modName >= possibleModules;
|
||||
*modName--)
|
||||
CallModuleDllMain(*modName, DLL_PROCESS_DETACH);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
BOOL CallModuleDllMain(char *modName, DWORD dwReason) {
|
||||
BOOL(WINAPI * pfndllmain)(HINSTANCE, DWORD, LPVOID);
|
||||
|
||||
char funcName[255];
|
||||
HMODULE hmod = GetModuleHandleW(NULL);
|
||||
strcpy(funcName, "_DllMain");
|
||||
strcat(funcName, modName);
|
||||
strcat(funcName, "@12"); // stdcall convention.
|
||||
pfndllmain =
|
||||
(BOOL(WINAPI *)(HINSTANCE, DWORD, LPVOID))GetProcAddress(hmod, funcName);
|
||||
if (pfndllmain == NULL) {
|
||||
/* No function by that name exported - then that module does
|
||||
not appear in our frozen program - return OK
|
||||
*/
|
||||
return TRUE;
|
||||
}
|
||||
return (*pfndllmain)(hmod, dwReason, NULL);
|
||||
}
|
||||
|
||||
BOOL CallModuleDllMain(char *modName, DWORD dwReason)
|
||||
{
|
||||
BOOL (WINAPI * pfndllmain)(HINSTANCE, DWORD, LPVOID);
|
||||
|
||||
char funcName[255];
|
||||
HMODULE hmod = GetModuleHandleW(NULL);
|
||||
strcpy(funcName, "_DllMain");
|
||||
strcat(funcName, modName);
|
||||
strcat(funcName, "@12"); // stdcall convention.
|
||||
pfndllmain = (BOOL (WINAPI *)(HINSTANCE, DWORD, LPVOID))GetProcAddress(hmod, funcName);
|
||||
if (pfndllmain==NULL) {
|
||||
/* No function by that name exported - then that module does
|
||||
not appear in our frozen program - return OK
|
||||
*/
|
||||
return TRUE;
|
||||
}
|
||||
return (*pfndllmain)(hmod, dwReason, NULL);
|
||||
}
|
||||
|
||||
|
|
32
third_party/python/PC/generrmap.c
vendored
|
@ -1,32 +0,0 @@
|
|||
#include <windows.h>
|
||||
#include <fcntl.h>
|
||||
#include <io.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
|
||||
/* Extract the mapping of Win32 error codes to errno */
|
||||
|
||||
int main()
|
||||
{
|
||||
int i;
|
||||
_setmode(fileno(stdout), O_BINARY);
|
||||
printf("/* Generated file. Do not edit. */\n");
|
||||
printf("int winerror_to_errno(int winerror)\n");
|
||||
printf("{\n switch(winerror) {\n");
|
||||
for(i=1; i < 65000; i++) {
|
||||
_dosmaperr(i);
|
||||
if (errno == EINVAL) {
|
||||
/* Issue #12802 */
|
||||
if (i == ERROR_DIRECTORY)
|
||||
errno = ENOTDIR;
|
||||
/* Issue #13063 */
|
||||
else if (i == ERROR_NO_DATA)
|
||||
errno = EPIPE;
|
||||
else
|
||||
continue;
|
||||
}
|
||||
printf(" case %d: return %d;\n", i, errno);
|
||||
}
|
||||
printf(" default: return EINVAL;\n");
|
||||
printf(" }\n}\n");
|
||||
}
|
1429
third_party/python/PC/getpathp.c
vendored
BIN
third_party/python/PC/icons/launcher.icns
vendored
BIN
third_party/python/PC/icons/launcher.ico
vendored
Before Width: | Height: | Size: 85 KiB |
BIN
third_party/python/PC/icons/py.icns
vendored
BIN
third_party/python/PC/icons/py.ico
vendored
Before Width: | Height: | Size: 74 KiB |
BIN
third_party/python/PC/icons/pyc.icns
vendored
BIN
third_party/python/PC/icons/pyc.ico
vendored
Before Width: | Height: | Size: 77 KiB |
BIN
third_party/python/PC/icons/pyd.icns
vendored
BIN
third_party/python/PC/icons/pyd.ico
vendored
Before Width: | Height: | Size: 81 KiB |
BIN
third_party/python/PC/icons/python.icns
vendored
BIN
third_party/python/PC/icons/python.ico
vendored
Before Width: | Height: | Size: 76 KiB |
BIN
third_party/python/PC/icons/pythonw.icns
vendored
BIN
third_party/python/PC/icons/pythonw.ico
vendored
Before Width: | Height: | Size: 74 KiB |
BIN
third_party/python/PC/icons/setup.icns
vendored
BIN
third_party/python/PC/icons/setup.ico
vendored
Before Width: | Height: | Size: 76 KiB |
|
@ -1,21 +1,20 @@
|
|||
#ifdef _MSC_VER
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#if _MSC_VER >= 1900
|
||||
/* pyconfig.h uses this function in the _Py_BEGIN/END_SUPPRESS_IPH
|
||||
* macros. It does not need to be defined when building using MSVC
|
||||
* earlier than 14.0 (_MSC_VER == 1900).
|
||||
*/
|
||||
|
||||
static void __cdecl _silent_invalid_parameter_handler(
|
||||
wchar_t const* expression,
|
||||
wchar_t const* function,
|
||||
wchar_t const* file,
|
||||
unsigned int line,
|
||||
uintptr_t pReserved) { }
|
||||
static void __cdecl _silent_invalid_parameter_handler(wchar_t const* expression,
|
||||
wchar_t const* function,
|
||||
wchar_t const* file,
|
||||
unsigned int line,
|
||||
uintptr_t pReserved) {
|
||||
}
|
||||
|
||||
_invalid_parameter_handler _Py_silent_invalid_parameter_handler = _silent_invalid_parameter_handler;
|
||||
_invalid_parameter_handler _Py_silent_invalid_parameter_handler =
|
||||
_silent_invalid_parameter_handler;
|
||||
|
||||
#endif
|
||||
|
||||
|
|
6
third_party/python/PC/launcher.c
vendored
|
@ -1,3 +1,4 @@
|
|||
/* clang-format off */
|
||||
/*
|
||||
* Copyright (C) 2011-2013 Vinay Sajip.
|
||||
* Licensed to PSF under a contributor agreement.
|
||||
|
@ -8,11 +9,6 @@
|
|||
* Curt Hagenlocher (job management)
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
#include <shlobj.h>
|
||||
#include <stdio.h>
|
||||
#include <tchar.h>
|
||||
|
||||
#define BUFSIZE 256
|
||||
#define MSGSIZE 1024
|
||||
|
||||
|
|
606
third_party/python/PC/msvcrtmodule.c
vendored
|
@ -1,606 +0,0 @@
|
|||
/*********************************************************
|
||||
|
||||
msvcrtmodule.c
|
||||
|
||||
A Python interface to the Microsoft Visual C Runtime
|
||||
Library, providing access to those non-portable, but
|
||||
still useful routines.
|
||||
|
||||
Only ever compiled with an MS compiler, so no attempt
|
||||
has been made to avoid MS language extensions, etc...
|
||||
|
||||
This may only work on NT or 95...
|
||||
|
||||
Author: Mark Hammond and Guido van Rossum.
|
||||
Maintenance: Guido van Rossum.
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "Python.h"
|
||||
#include "malloc.h"
|
||||
#include <io.h>
|
||||
#include <conio.h>
|
||||
#include <sys/locking.h>
|
||||
#include <crtdbg.h>
|
||||
#include <windows.h>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#if _MSC_VER >= 1500 && _MSC_VER < 1600
|
||||
#include <crtassem.h>
|
||||
#elif _MSC_VER >= 1600
|
||||
#include <crtversion.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*[python input]
|
||||
class intptr_t_converter(CConverter):
|
||||
type = 'intptr_t'
|
||||
format_unit = '"_Py_PARSE_INTPTR"'
|
||||
|
||||
class handle_return_converter(long_return_converter):
|
||||
type = 'intptr_t'
|
||||
cast = '(void *)'
|
||||
conversion_fn = 'PyLong_FromVoidPtr'
|
||||
|
||||
class byte_char_return_converter(CReturnConverter):
|
||||
type = 'int'
|
||||
|
||||
def render(self, function, data):
|
||||
data.declarations.append('char s[1];')
|
||||
data.return_value = 's[0]'
|
||||
data.return_conversion.append(
|
||||
'return_value = PyBytes_FromStringAndSize(s, 1);\n')
|
||||
|
||||
class wchar_t_return_converter(CReturnConverter):
|
||||
type = 'wchar_t'
|
||||
|
||||
def render(self, function, data):
|
||||
self.declare(data)
|
||||
data.return_conversion.append(
|
||||
'return_value = PyUnicode_FromOrdinal(_return_value);\n')
|
||||
[python start generated code]*/
|
||||
/*[python end generated code: output=da39a3ee5e6b4b0d input=b59f1663dba11997]*/
|
||||
|
||||
/*[clinic input]
|
||||
module msvcrt
|
||||
[clinic start generated code]*/
|
||||
/*[clinic end generated code: output=da39a3ee5e6b4b0d input=f31a87a783d036cd]*/
|
||||
|
||||
#include "clinic/msvcrtmodule.c.h"
|
||||
|
||||
/*[clinic input]
|
||||
msvcrt.heapmin
|
||||
|
||||
Minimize the malloc() heap.
|
||||
|
||||
Force the malloc() heap to clean itself up and return unused blocks
|
||||
to the operating system. On failure, this raises OSError.
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
msvcrt_heapmin_impl(PyObject *module)
|
||||
/*[clinic end generated code: output=1ba00f344782dc19 input=82e1771d21bde2d8]*/
|
||||
{
|
||||
if (_heapmin() != 0)
|
||||
return PyErr_SetFromErrno(PyExc_IOError);
|
||||
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
/*[clinic input]
|
||||
msvcrt.locking
|
||||
|
||||
fd: int
|
||||
mode: int
|
||||
nbytes: long
|
||||
/
|
||||
|
||||
Lock part of a file based on file descriptor fd from the C runtime.
|
||||
|
||||
Raises IOError on failure. The locked region of the file extends from
|
||||
the current file position for nbytes bytes, and may continue beyond
|
||||
the end of the file. mode must be one of the LK_* constants listed
|
||||
below. Multiple regions in a file may be locked at the same time, but
|
||||
may not overlap. Adjacent regions are not merged; they must be unlocked
|
||||
individually.
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
msvcrt_locking_impl(PyObject *module, int fd, int mode, long nbytes)
|
||||
/*[clinic end generated code: output=a4a90deca9785a03 input=d9f13f0f6a713ba7]*/
|
||||
{
|
||||
int err;
|
||||
|
||||
Py_BEGIN_ALLOW_THREADS
|
||||
_Py_BEGIN_SUPPRESS_IPH
|
||||
err = _locking(fd, mode, nbytes);
|
||||
_Py_END_SUPPRESS_IPH
|
||||
Py_END_ALLOW_THREADS
|
||||
if (err != 0)
|
||||
return PyErr_SetFromErrno(PyExc_IOError);
|
||||
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
/*[clinic input]
|
||||
msvcrt.setmode -> long
|
||||
|
||||
fd: int
|
||||
mode as flags: int
|
||||
/
|
||||
|
||||
Set the line-end translation mode for the file descriptor fd.
|
||||
|
||||
To set it to text mode, flags should be os.O_TEXT; for binary, it
|
||||
should be os.O_BINARY.
|
||||
|
||||
Return value is the previous mode.
|
||||
[clinic start generated code]*/
|
||||
|
||||
static long
|
||||
msvcrt_setmode_impl(PyObject *module, int fd, int flags)
|
||||
/*[clinic end generated code: output=24a9be5ea07ccb9b input=76e7c01f6b137f75]*/
|
||||
{
|
||||
_Py_BEGIN_SUPPRESS_IPH
|
||||
flags = _setmode(fd, flags);
|
||||
_Py_END_SUPPRESS_IPH
|
||||
if (flags == -1)
|
||||
PyErr_SetFromErrno(PyExc_IOError);
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
/*[clinic input]
|
||||
msvcrt.open_osfhandle -> long
|
||||
|
||||
handle: intptr_t
|
||||
flags: int
|
||||
/
|
||||
|
||||
Create a C runtime file descriptor from the file handle handle.
|
||||
|
||||
The flags parameter should be a bitwise OR of os.O_APPEND, os.O_RDONLY,
|
||||
and os.O_TEXT. The returned file descriptor may be used as a parameter
|
||||
to os.fdopen() to create a file object.
|
||||
[clinic start generated code]*/
|
||||
|
||||
static long
|
||||
msvcrt_open_osfhandle_impl(PyObject *module, intptr_t handle, int flags)
|
||||
/*[clinic end generated code: output=cede871bf939d6e3 input=cb2108bbea84514e]*/
|
||||
{
|
||||
int fd;
|
||||
|
||||
_Py_BEGIN_SUPPRESS_IPH
|
||||
fd = _open_osfhandle(handle, flags);
|
||||
_Py_END_SUPPRESS_IPH
|
||||
if (fd == -1)
|
||||
PyErr_SetFromErrno(PyExc_IOError);
|
||||
|
||||
return fd;
|
||||
}
|
||||
|
||||
/*[clinic input]
|
||||
msvcrt.get_osfhandle -> handle
|
||||
|
||||
fd: int
|
||||
/
|
||||
|
||||
Return the file handle for the file descriptor fd.
|
||||
|
||||
Raises IOError if fd is not recognized.
|
||||
[clinic start generated code]*/
|
||||
|
||||
static intptr_t
|
||||
msvcrt_get_osfhandle_impl(PyObject *module, int fd)
|
||||
/*[clinic end generated code: output=7ce761dd0de2b503 input=c7d18d02c8017ec1]*/
|
||||
{
|
||||
intptr_t handle = -1;
|
||||
|
||||
_Py_BEGIN_SUPPRESS_IPH
|
||||
handle = _get_osfhandle(fd);
|
||||
_Py_END_SUPPRESS_IPH
|
||||
if (handle == -1)
|
||||
PyErr_SetFromErrno(PyExc_IOError);
|
||||
|
||||
return handle;
|
||||
}
|
||||
|
||||
/* Console I/O */
|
||||
/*[clinic input]
|
||||
msvcrt.kbhit -> long
|
||||
|
||||
Return true if a keypress is waiting to be read.
|
||||
[clinic start generated code]*/
|
||||
|
||||
static long
|
||||
msvcrt_kbhit_impl(PyObject *module)
|
||||
/*[clinic end generated code: output=940dfce6587c1890 input=e70d678a5c2f6acc]*/
|
||||
{
|
||||
return _kbhit();
|
||||
}
|
||||
|
||||
/*[clinic input]
|
||||
msvcrt.getch -> byte_char
|
||||
|
||||
Read a keypress and return the resulting character as a byte string.
|
||||
|
||||
Nothing is echoed to the console. This call will block if a keypress is
|
||||
not already available, but will not wait for Enter to be pressed. If the
|
||||
pressed key was a special function key, this will return '\000' or
|
||||
'\xe0'; the next call will return the keycode. The Control-C keypress
|
||||
cannot be read with this function.
|
||||
[clinic start generated code]*/
|
||||
|
||||
static int
|
||||
msvcrt_getch_impl(PyObject *module)
|
||||
/*[clinic end generated code: output=a4e51f0565064a7d input=37a40cf0ed0d1153]*/
|
||||
{
|
||||
int ch;
|
||||
|
||||
Py_BEGIN_ALLOW_THREADS
|
||||
ch = _getch();
|
||||
Py_END_ALLOW_THREADS
|
||||
return ch;
|
||||
}
|
||||
|
||||
/*[clinic input]
|
||||
msvcrt.getwch -> wchar_t
|
||||
|
||||
Wide char variant of getch(), returning a Unicode value.
|
||||
[clinic start generated code]*/
|
||||
|
||||
static wchar_t
|
||||
msvcrt_getwch_impl(PyObject *module)
|
||||
/*[clinic end generated code: output=be9937494e22f007 input=27b3dec8ad823d7c]*/
|
||||
{
|
||||
wchar_t ch;
|
||||
|
||||
Py_BEGIN_ALLOW_THREADS
|
||||
ch = _getwch();
|
||||
Py_END_ALLOW_THREADS
|
||||
return ch;
|
||||
}
|
||||
|
||||
/*[clinic input]
|
||||
msvcrt.getche -> byte_char
|
||||
|
||||
Similar to getch(), but the keypress will be echoed if possible.
|
||||
[clinic start generated code]*/
|
||||
|
||||
static int
|
||||
msvcrt_getche_impl(PyObject *module)
|
||||
/*[clinic end generated code: output=d8f7db4fd2990401 input=43311ade9ed4a9c0]*/
|
||||
{
|
||||
int ch;
|
||||
|
||||
Py_BEGIN_ALLOW_THREADS
|
||||
ch = _getche();
|
||||
Py_END_ALLOW_THREADS
|
||||
return ch;
|
||||
}
|
||||
|
||||
/*[clinic input]
|
||||
msvcrt.getwche -> wchar_t
|
||||
|
||||
Wide char variant of getche(), returning a Unicode value.
|
||||
[clinic start generated code]*/
|
||||
|
||||
static wchar_t
|
||||
msvcrt_getwche_impl(PyObject *module)
|
||||
/*[clinic end generated code: output=d0dae5ba3829d596 input=49337d59d1a591f8]*/
|
||||
{
|
||||
wchar_t ch;
|
||||
|
||||
Py_BEGIN_ALLOW_THREADS
|
||||
ch = _getwche();
|
||||
Py_END_ALLOW_THREADS
|
||||
return ch;
|
||||
}
|
||||
|
||||
/*[clinic input]
|
||||
msvcrt.putch
|
||||
|
||||
char: char
|
||||
/
|
||||
|
||||
Print the byte string char to the console without buffering.
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
msvcrt_putch_impl(PyObject *module, char char_value)
|
||||
/*[clinic end generated code: output=92ec9b81012d8f60 input=ec078dd10cb054d6]*/
|
||||
{
|
||||
_Py_BEGIN_SUPPRESS_IPH
|
||||
_putch(char_value);
|
||||
_Py_END_SUPPRESS_IPH
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
/*[clinic input]
|
||||
msvcrt.putwch
|
||||
|
||||
unicode_char: int(accept={str})
|
||||
/
|
||||
|
||||
Wide char variant of putch(), accepting a Unicode value.
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
msvcrt_putwch_impl(PyObject *module, int unicode_char)
|
||||
/*[clinic end generated code: output=a3bd1a8951d28eee input=996ccd0bbcbac4c3]*/
|
||||
{
|
||||
_Py_BEGIN_SUPPRESS_IPH
|
||||
_putwch(unicode_char);
|
||||
_Py_END_SUPPRESS_IPH
|
||||
Py_RETURN_NONE;
|
||||
|
||||
}
|
||||
|
||||
/*[clinic input]
|
||||
msvcrt.ungetch
|
||||
|
||||
char: char
|
||||
/
|
||||
|
||||
Opposite of getch.
|
||||
|
||||
Cause the byte string char to be "pushed back" into the
|
||||
console buffer; it will be the next character read by
|
||||
getch() or getche().
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
msvcrt_ungetch_impl(PyObject *module, char char_value)
|
||||
/*[clinic end generated code: output=c6942a0efa119000 input=22f07ee9001bbf0f]*/
|
||||
{
|
||||
int res;
|
||||
|
||||
_Py_BEGIN_SUPPRESS_IPH
|
||||
res = _ungetch(char_value);
|
||||
_Py_END_SUPPRESS_IPH
|
||||
|
||||
if (res == EOF)
|
||||
return PyErr_SetFromErrno(PyExc_IOError);
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
/*[clinic input]
|
||||
msvcrt.ungetwch
|
||||
|
||||
unicode_char: int(accept={str})
|
||||
/
|
||||
|
||||
Wide char variant of ungetch(), accepting a Unicode value.
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
msvcrt_ungetwch_impl(PyObject *module, int unicode_char)
|
||||
/*[clinic end generated code: output=e63af05438b8ba3d input=83ec0492be04d564]*/
|
||||
{
|
||||
int res;
|
||||
|
||||
_Py_BEGIN_SUPPRESS_IPH
|
||||
res = _ungetwch(unicode_char);
|
||||
_Py_END_SUPPRESS_IPH
|
||||
|
||||
if (res == WEOF)
|
||||
return PyErr_SetFromErrno(PyExc_IOError);
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
/*[clinic input]
|
||||
msvcrt.CrtSetReportFile -> long
|
||||
|
||||
type: int
|
||||
file: int
|
||||
/
|
||||
|
||||
Wrapper around _CrtSetReportFile.
|
||||
|
||||
Only available on Debug builds.
|
||||
[clinic start generated code]*/
|
||||
|
||||
static long
|
||||
msvcrt_CrtSetReportFile_impl(PyObject *module, int type, int file)
|
||||
/*[clinic end generated code: output=df291c7fe032eb68 input=bb8f721a604fcc45]*/
|
||||
{
|
||||
long res;
|
||||
|
||||
_Py_BEGIN_SUPPRESS_IPH
|
||||
res = (long)_CrtSetReportFile(type, (_HFILE)file);
|
||||
_Py_END_SUPPRESS_IPH
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
/*[clinic input]
|
||||
msvcrt.CrtSetReportMode -> long
|
||||
|
||||
type: int
|
||||
mode: int
|
||||
/
|
||||
|
||||
Wrapper around _CrtSetReportMode.
|
||||
|
||||
Only available on Debug builds.
|
||||
[clinic start generated code]*/
|
||||
|
||||
static long
|
||||
msvcrt_CrtSetReportMode_impl(PyObject *module, int type, int mode)
|
||||
/*[clinic end generated code: output=b2863761523de317 input=9319d29b4319426b]*/
|
||||
{
|
||||
int res;
|
||||
|
||||
_Py_BEGIN_SUPPRESS_IPH
|
||||
res = _CrtSetReportMode(type, mode);
|
||||
_Py_END_SUPPRESS_IPH
|
||||
if (res == -1)
|
||||
PyErr_SetFromErrno(PyExc_IOError);
|
||||
return res;
|
||||
}
|
||||
|
||||
/*[clinic input]
|
||||
msvcrt.set_error_mode -> long
|
||||
|
||||
mode: int
|
||||
/
|
||||
|
||||
Wrapper around _set_error_mode.
|
||||
|
||||
Only available on Debug builds.
|
||||
[clinic start generated code]*/
|
||||
|
||||
static long
|
||||
msvcrt_set_error_mode_impl(PyObject *module, int mode)
|
||||
/*[clinic end generated code: output=ac4a09040d8ac4e3 input=046fca59c0f20872]*/
|
||||
{
|
||||
long res;
|
||||
|
||||
_Py_BEGIN_SUPPRESS_IPH
|
||||
res = _set_error_mode(mode);
|
||||
_Py_END_SUPPRESS_IPH
|
||||
|
||||
return res;
|
||||
}
|
||||
#endif /* _DEBUG */
|
||||
|
||||
/*[clinic input]
|
||||
msvcrt.SetErrorMode
|
||||
|
||||
mode: unsigned_int(bitwise=True)
|
||||
/
|
||||
|
||||
Wrapper around SetErrorMode.
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
msvcrt_SetErrorMode_impl(PyObject *module, unsigned int mode)
|
||||
/*[clinic end generated code: output=01d529293f00da8f input=d8b167258d32d907]*/
|
||||
{
|
||||
unsigned int res;
|
||||
|
||||
_Py_BEGIN_SUPPRESS_IPH
|
||||
res = SetErrorMode(mode);
|
||||
_Py_END_SUPPRESS_IPH
|
||||
|
||||
return PyLong_FromUnsignedLong(res);
|
||||
}
|
||||
|
||||
/*[clinic input]
|
||||
[clinic start generated code]*/
|
||||
/*[clinic end generated code: output=da39a3ee5e6b4b0d input=da39a3ee5e6b4b0d]*/
|
||||
|
||||
/* List of functions exported by this module */
|
||||
static struct PyMethodDef msvcrt_functions[] = {
|
||||
MSVCRT_HEAPMIN_METHODDEF
|
||||
MSVCRT_LOCKING_METHODDEF
|
||||
MSVCRT_SETMODE_METHODDEF
|
||||
MSVCRT_OPEN_OSFHANDLE_METHODDEF
|
||||
MSVCRT_GET_OSFHANDLE_METHODDEF
|
||||
MSVCRT_KBHIT_METHODDEF
|
||||
MSVCRT_GETCH_METHODDEF
|
||||
MSVCRT_GETCHE_METHODDEF
|
||||
MSVCRT_PUTCH_METHODDEF
|
||||
MSVCRT_UNGETCH_METHODDEF
|
||||
MSVCRT_SETERRORMODE_METHODDEF
|
||||
MSVCRT_CRTSETREPORTFILE_METHODDEF
|
||||
MSVCRT_CRTSETREPORTMODE_METHODDEF
|
||||
MSVCRT_SET_ERROR_MODE_METHODDEF
|
||||
MSVCRT_GETWCH_METHODDEF
|
||||
MSVCRT_GETWCHE_METHODDEF
|
||||
MSVCRT_PUTWCH_METHODDEF
|
||||
MSVCRT_UNGETWCH_METHODDEF
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
|
||||
static struct PyModuleDef msvcrtmodule = {
|
||||
PyModuleDef_HEAD_INIT,
|
||||
"msvcrt",
|
||||
NULL,
|
||||
-1,
|
||||
msvcrt_functions,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
static void
|
||||
insertint(PyObject *d, char *name, int value)
|
||||
{
|
||||
PyObject *v = PyLong_FromLong((long) value);
|
||||
if (v == NULL) {
|
||||
/* Don't bother reporting this error */
|
||||
PyErr_Clear();
|
||||
}
|
||||
else {
|
||||
PyDict_SetItemString(d, name, v);
|
||||
Py_DECREF(v);
|
||||
}
|
||||
}
|
||||
|
||||
PyMODINIT_FUNC
|
||||
PyInit_msvcrt(void)
|
||||
{
|
||||
int st;
|
||||
PyObject *d, *version;
|
||||
PyObject *m = PyModule_Create(&msvcrtmodule);
|
||||
if (m == NULL)
|
||||
return NULL;
|
||||
d = PyModule_GetDict(m);
|
||||
|
||||
/* constants for the locking() function's mode argument */
|
||||
insertint(d, "LK_LOCK", _LK_LOCK);
|
||||
insertint(d, "LK_NBLCK", _LK_NBLCK);
|
||||
insertint(d, "LK_NBRLCK", _LK_NBRLCK);
|
||||
insertint(d, "LK_RLCK", _LK_RLCK);
|
||||
insertint(d, "LK_UNLCK", _LK_UNLCK);
|
||||
insertint(d, "SEM_FAILCRITICALERRORS", SEM_FAILCRITICALERRORS);
|
||||
insertint(d, "SEM_NOALIGNMENTFAULTEXCEPT", SEM_NOALIGNMENTFAULTEXCEPT);
|
||||
insertint(d, "SEM_NOGPFAULTERRORBOX", SEM_NOGPFAULTERRORBOX);
|
||||
insertint(d, "SEM_NOOPENFILEERRORBOX", SEM_NOOPENFILEERRORBOX);
|
||||
#ifdef _DEBUG
|
||||
insertint(d, "CRT_WARN", _CRT_WARN);
|
||||
insertint(d, "CRT_ERROR", _CRT_ERROR);
|
||||
insertint(d, "CRT_ASSERT", _CRT_ASSERT);
|
||||
insertint(d, "CRTDBG_MODE_DEBUG", _CRTDBG_MODE_DEBUG);
|
||||
insertint(d, "CRTDBG_MODE_FILE", _CRTDBG_MODE_FILE);
|
||||
insertint(d, "CRTDBG_MODE_WNDW", _CRTDBG_MODE_WNDW);
|
||||
insertint(d, "CRTDBG_REPORT_MODE", _CRTDBG_REPORT_MODE);
|
||||
insertint(d, "CRTDBG_FILE_STDERR", (int)_CRTDBG_FILE_STDERR);
|
||||
insertint(d, "CRTDBG_FILE_STDOUT", (int)_CRTDBG_FILE_STDOUT);
|
||||
insertint(d, "CRTDBG_REPORT_FILE", (int)_CRTDBG_REPORT_FILE);
|
||||
#endif
|
||||
|
||||
/* constants for the crt versions */
|
||||
#ifdef _VC_ASSEMBLY_PUBLICKEYTOKEN
|
||||
st = PyModule_AddStringConstant(m, "VC_ASSEMBLY_PUBLICKEYTOKEN",
|
||||
_VC_ASSEMBLY_PUBLICKEYTOKEN);
|
||||
if (st < 0) return NULL;
|
||||
#endif
|
||||
#ifdef _CRT_ASSEMBLY_VERSION
|
||||
st = PyModule_AddStringConstant(m, "CRT_ASSEMBLY_VERSION",
|
||||
_CRT_ASSEMBLY_VERSION);
|
||||
if (st < 0) return NULL;
|
||||
#endif
|
||||
#ifdef __LIBRARIES_ASSEMBLY_NAME_PREFIX
|
||||
st = PyModule_AddStringConstant(m, "LIBRARIES_ASSEMBLY_NAME_PREFIX",
|
||||
__LIBRARIES_ASSEMBLY_NAME_PREFIX);
|
||||
if (st < 0) return NULL;
|
||||
#endif
|
||||
|
||||
/* constants for the 2010 crt versions */
|
||||
#if defined(_VC_CRT_MAJOR_VERSION) && defined (_VC_CRT_MINOR_VERSION) && defined(_VC_CRT_BUILD_VERSION) && defined(_VC_CRT_RBUILD_VERSION)
|
||||
version = PyUnicode_FromFormat("%d.%d.%d.%d", _VC_CRT_MAJOR_VERSION,
|
||||
_VC_CRT_MINOR_VERSION,
|
||||
_VC_CRT_BUILD_VERSION,
|
||||
_VC_CRT_RBUILD_VERSION);
|
||||
st = PyModule_AddObject(m, "CRT_ASSEMBLY_VERSION", version);
|
||||
if (st < 0) return NULL;
|
||||
#endif
|
||||
/* make compiler warning quiet if st is unused */
|
||||
(void)st;
|
||||
|
||||
return m;
|
||||
}
|
54
third_party/python/PC/pylauncher.rc
vendored
|
@ -1,54 +0,0 @@
|
|||
#include <windows.h>
|
||||
|
||||
#include "python_ver_rc.h"
|
||||
|
||||
// Include the manifest file that indicates we support all
|
||||
// current versions of Windows.
|
||||
#include <winuser.h>
|
||||
1 RT_MANIFEST "python.manifest"
|
||||
|
||||
1 ICON DISCARDABLE "icons\launcher.ico"
|
||||
2 ICON DISCARDABLE "icons\py.ico"
|
||||
3 ICON DISCARDABLE "icons\pyc.ico"
|
||||
4 ICON DISCARDABLE "icons\pyd.ico"
|
||||
5 ICON DISCARDABLE "icons\python.ico"
|
||||
6 ICON DISCARDABLE "icons\pythonw.ico"
|
||||
7 ICON DISCARDABLE "icons\setup.ico"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Version
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION PYVERSION64
|
||||
PRODUCTVERSION PYVERSION64
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS VS_FF_DEBUG
|
||||
#else
|
||||
FILEFLAGS 0x0L
|
||||
#endif
|
||||
FILEOS VOS__WINDOWS32
|
||||
FILETYPE VFT_APP
|
||||
FILESUBTYPE 0x0L
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "000004b0"
|
||||
BEGIN
|
||||
VALUE "CompanyName", PYTHON_COMPANY "\0"
|
||||
VALUE "FileDescription", "Python\0"
|
||||
VALUE "FileVersion", PYTHON_VERSION
|
||||
VALUE "InternalName", "Python Launcher\0"
|
||||
VALUE "LegalCopyright", PYTHON_COPYRIGHT "\0"
|
||||
VALUE "OriginalFilename", "py" PYTHON_DEBUG_EXT ".exe\0"
|
||||
VALUE "ProductName", "Python\0"
|
||||
VALUE "ProductVersion", PYTHON_VERSION
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x0, 1200
|
||||
END
|
||||
END
|
610
third_party/python/PC/pyshellext.cpp
vendored
|
@ -1,610 +0,0 @@
|
|||
// Support back to Vista
|
||||
#define _WIN32_WINNT _WIN32_WINNT_VISTA
|
||||
#include <sdkddkver.h>
|
||||
|
||||
// Use WRL to define a classic COM class
|
||||
#define __WRL_CLASSIC_COM__
|
||||
#include <wrl.h>
|
||||
|
||||
#include <windows.h>
|
||||
#include <shlobj.h>
|
||||
#include <shlwapi.h>
|
||||
#include <olectl.h>
|
||||
#include <strsafe.h>
|
||||
|
||||
#include "pyshellext_h.h"
|
||||
|
||||
#define DDWM_UPDATEWINDOW (WM_USER+3)
|
||||
|
||||
static HINSTANCE hModule;
|
||||
static CLIPFORMAT cfDropDescription;
|
||||
static CLIPFORMAT cfDragWindow;
|
||||
|
||||
static const LPCWSTR CLASS_SUBKEY = L"Software\\Classes\\CLSID\\{BEA218D2-6950-497B-9434-61683EC065FE}";
|
||||
static const LPCWSTR DRAG_MESSAGE = L"Open with %1";
|
||||
|
||||
using namespace Microsoft::WRL;
|
||||
|
||||
HRESULT FilenameListCchLengthA(LPCSTR pszSource, size_t cchMax, size_t *pcchLength, size_t *pcchCount) {
|
||||
HRESULT hr = S_OK;
|
||||
size_t count = 0;
|
||||
size_t length = 0;
|
||||
|
||||
while (pszSource && pszSource[0]) {
|
||||
size_t oneLength;
|
||||
hr = StringCchLengthA(pszSource, cchMax - length, &oneLength);
|
||||
if (FAILED(hr)) {
|
||||
return hr;
|
||||
}
|
||||
count += 1;
|
||||
length += oneLength + (strchr(pszSource, ' ') ? 3 : 1);
|
||||
pszSource = &pszSource[oneLength + 1];
|
||||
}
|
||||
|
||||
*pcchCount = count;
|
||||
*pcchLength = length;
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT FilenameListCchLengthW(LPCWSTR pszSource, size_t cchMax, size_t *pcchLength, size_t *pcchCount) {
|
||||
HRESULT hr = S_OK;
|
||||
size_t count = 0;
|
||||
size_t length = 0;
|
||||
|
||||
while (pszSource && pszSource[0]) {
|
||||
size_t oneLength;
|
||||
hr = StringCchLengthW(pszSource, cchMax - length, &oneLength);
|
||||
if (FAILED(hr)) {
|
||||
return hr;
|
||||
}
|
||||
count += 1;
|
||||
length += oneLength + (wcschr(pszSource, ' ') ? 3 : 1);
|
||||
pszSource = &pszSource[oneLength + 1];
|
||||
}
|
||||
|
||||
*pcchCount = count;
|
||||
*pcchLength = length;
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT FilenameListCchCopyA(STRSAFE_LPSTR pszDest, size_t cchDest, LPCSTR pszSource, LPCSTR pszSeparator) {
|
||||
HRESULT hr = S_OK;
|
||||
size_t count = 0;
|
||||
size_t length = 0;
|
||||
|
||||
while (pszSource[0]) {
|
||||
STRSAFE_LPSTR newDest;
|
||||
|
||||
hr = StringCchCopyExA(pszDest, cchDest, pszSource, &newDest, &cchDest, 0);
|
||||
if (FAILED(hr)) {
|
||||
return hr;
|
||||
}
|
||||
pszSource += (newDest - pszDest) + 1;
|
||||
pszDest = PathQuoteSpacesA(pszDest) ? newDest + 2 : newDest;
|
||||
|
||||
if (pszSource[0]) {
|
||||
hr = StringCchCopyExA(pszDest, cchDest, pszSeparator, &newDest, &cchDest, 0);
|
||||
if (FAILED(hr)) {
|
||||
return hr;
|
||||
}
|
||||
pszDest = newDest;
|
||||
}
|
||||
}
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT FilenameListCchCopyW(STRSAFE_LPWSTR pszDest, size_t cchDest, LPCWSTR pszSource, LPCWSTR pszSeparator) {
|
||||
HRESULT hr = S_OK;
|
||||
size_t count = 0;
|
||||
size_t length = 0;
|
||||
|
||||
while (pszSource[0]) {
|
||||
STRSAFE_LPWSTR newDest;
|
||||
|
||||
hr = StringCchCopyExW(pszDest, cchDest, pszSource, &newDest, &cchDest, 0);
|
||||
if (FAILED(hr)) {
|
||||
return hr;
|
||||
}
|
||||
pszSource += (newDest - pszDest) + 1;
|
||||
pszDest = PathQuoteSpacesW(pszDest) ? newDest + 2 : newDest;
|
||||
|
||||
if (pszSource[0]) {
|
||||
hr = StringCchCopyExW(pszDest, cchDest, pszSeparator, &newDest, &cchDest, 0);
|
||||
if (FAILED(hr)) {
|
||||
return hr;
|
||||
}
|
||||
pszDest = newDest;
|
||||
}
|
||||
}
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
|
||||
class PyShellExt : public RuntimeClass<
|
||||
RuntimeClassFlags<ClassicCom>,
|
||||
IDropTarget,
|
||||
IPersistFile
|
||||
>
|
||||
{
|
||||
LPOLESTR target, target_dir;
|
||||
DWORD target_mode;
|
||||
|
||||
IDataObject *data_obj;
|
||||
|
||||
public:
|
||||
PyShellExt() : target(NULL), target_dir(NULL), target_mode(0), data_obj(NULL) {
|
||||
OutputDebugString(L"PyShellExt::PyShellExt");
|
||||
}
|
||||
|
||||
~PyShellExt() {
|
||||
if (target) {
|
||||
CoTaskMemFree(target);
|
||||
}
|
||||
if (target_dir) {
|
||||
CoTaskMemFree(target_dir);
|
||||
}
|
||||
if (data_obj) {
|
||||
data_obj->Release();
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
HRESULT UpdateDropDescription(IDataObject *pDataObj) {
|
||||
STGMEDIUM medium;
|
||||
FORMATETC fmt = {
|
||||
cfDropDescription,
|
||||
NULL,
|
||||
DVASPECT_CONTENT,
|
||||
-1,
|
||||
TYMED_HGLOBAL
|
||||
};
|
||||
|
||||
auto hr = pDataObj->GetData(&fmt, &medium);
|
||||
if (FAILED(hr)) {
|
||||
OutputDebugString(L"PyShellExt::UpdateDropDescription - failed to get DROPDESCRIPTION format");
|
||||
return hr;
|
||||
}
|
||||
if (!medium.hGlobal) {
|
||||
OutputDebugString(L"PyShellExt::UpdateDropDescription - DROPDESCRIPTION format had NULL hGlobal");
|
||||
ReleaseStgMedium(&medium);
|
||||
return E_FAIL;
|
||||
}
|
||||
auto dd = (DROPDESCRIPTION*)GlobalLock(medium.hGlobal);
|
||||
if (!dd) {
|
||||
OutputDebugString(L"PyShellExt::UpdateDropDescription - failed to lock DROPDESCRIPTION hGlobal");
|
||||
ReleaseStgMedium(&medium);
|
||||
return E_FAIL;
|
||||
}
|
||||
StringCchCopy(dd->szMessage, sizeof(dd->szMessage) / sizeof(dd->szMessage[0]), DRAG_MESSAGE);
|
||||
StringCchCopy(dd->szInsert, sizeof(dd->szInsert) / sizeof(dd->szInsert[0]), PathFindFileNameW(target));
|
||||
dd->type = DROPIMAGE_MOVE;
|
||||
|
||||
GlobalUnlock(medium.hGlobal);
|
||||
ReleaseStgMedium(&medium);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT GetDragWindow(IDataObject *pDataObj, HWND *phWnd) {
|
||||
HRESULT hr;
|
||||
HWND *pMem;
|
||||
STGMEDIUM medium;
|
||||
FORMATETC fmt = {
|
||||
cfDragWindow,
|
||||
NULL,
|
||||
DVASPECT_CONTENT,
|
||||
-1,
|
||||
TYMED_HGLOBAL
|
||||
};
|
||||
|
||||
hr = pDataObj->GetData(&fmt, &medium);
|
||||
if (FAILED(hr)) {
|
||||
OutputDebugString(L"PyShellExt::GetDragWindow - failed to get DragWindow format");
|
||||
return hr;
|
||||
}
|
||||
if (!medium.hGlobal) {
|
||||
OutputDebugString(L"PyShellExt::GetDragWindow - DragWindow format had NULL hGlobal");
|
||||
ReleaseStgMedium(&medium);
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
pMem = (HWND*)GlobalLock(medium.hGlobal);
|
||||
if (!pMem) {
|
||||
OutputDebugString(L"PyShellExt::GetDragWindow - failed to lock DragWindow hGlobal");
|
||||
ReleaseStgMedium(&medium);
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
*phWnd = *pMem;
|
||||
|
||||
GlobalUnlock(medium.hGlobal);
|
||||
ReleaseStgMedium(&medium);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT GetArguments(IDataObject *pDataObj, LPCWSTR *pArguments) {
|
||||
HRESULT hr;
|
||||
DROPFILES *pdropfiles;
|
||||
|
||||
STGMEDIUM medium;
|
||||
FORMATETC fmt = {
|
||||
CF_HDROP,
|
||||
NULL,
|
||||
DVASPECT_CONTENT,
|
||||
-1,
|
||||
TYMED_HGLOBAL
|
||||
};
|
||||
|
||||
hr = pDataObj->GetData(&fmt, &medium);
|
||||
if (FAILED(hr)) {
|
||||
OutputDebugString(L"PyShellExt::GetArguments - failed to get CF_HDROP format");
|
||||
return hr;
|
||||
}
|
||||
if (!medium.hGlobal) {
|
||||
OutputDebugString(L"PyShellExt::GetArguments - CF_HDROP format had NULL hGlobal");
|
||||
ReleaseStgMedium(&medium);
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
pdropfiles = (DROPFILES*)GlobalLock(medium.hGlobal);
|
||||
if (!pdropfiles) {
|
||||
OutputDebugString(L"PyShellExt::GetArguments - failed to lock CF_HDROP hGlobal");
|
||||
ReleaseStgMedium(&medium);
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (pdropfiles->fWide) {
|
||||
LPCWSTR files = (LPCWSTR)((char*)pdropfiles + pdropfiles->pFiles);
|
||||
size_t len, count;
|
||||
hr = FilenameListCchLengthW(files, 32767, &len, &count);
|
||||
if (SUCCEEDED(hr)) {
|
||||
LPWSTR args = (LPWSTR)CoTaskMemAlloc(sizeof(WCHAR) * (len + 1));
|
||||
if (args) {
|
||||
hr = FilenameListCchCopyW(args, 32767, files, L" ");
|
||||
if (SUCCEEDED(hr)) {
|
||||
*pArguments = args;
|
||||
} else {
|
||||
CoTaskMemFree(args);
|
||||
}
|
||||
} else {
|
||||
hr = E_OUTOFMEMORY;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
LPCSTR files = (LPCSTR)((char*)pdropfiles + pdropfiles->pFiles);
|
||||
size_t len, count;
|
||||
hr = FilenameListCchLengthA(files, 32767, &len, &count);
|
||||
if (SUCCEEDED(hr)) {
|
||||
LPSTR temp = (LPSTR)CoTaskMemAlloc(sizeof(CHAR) * (len + 1));
|
||||
if (temp) {
|
||||
hr = FilenameListCchCopyA(temp, 32767, files, " ");
|
||||
if (SUCCEEDED(hr)) {
|
||||
int wlen = MultiByteToWideChar(CP_ACP, 0, temp, (int)len, NULL, 0);
|
||||
if (wlen) {
|
||||
LPWSTR args = (LPWSTR)CoTaskMemAlloc(sizeof(WCHAR) * (wlen + 1));
|
||||
if (MultiByteToWideChar(CP_ACP, 0, temp, (int)len, args, wlen + 1)) {
|
||||
*pArguments = args;
|
||||
} else {
|
||||
OutputDebugString(L"PyShellExt::GetArguments - failed to convert multi-byte to wide-char path");
|
||||
CoTaskMemFree(args);
|
||||
hr = E_FAIL;
|
||||
}
|
||||
} else {
|
||||
OutputDebugString(L"PyShellExt::GetArguments - failed to get length of wide-char path");
|
||||
hr = E_FAIL;
|
||||
}
|
||||
}
|
||||
CoTaskMemFree(temp);
|
||||
} else {
|
||||
hr = E_OUTOFMEMORY;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GlobalUnlock(medium.hGlobal);
|
||||
ReleaseStgMedium(&medium);
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT NotifyDragWindow(HWND hwnd) {
|
||||
LRESULT res;
|
||||
|
||||
if (!hwnd) {
|
||||
return S_FALSE;
|
||||
}
|
||||
|
||||
res = SendMessage(hwnd, DDWM_UPDATEWINDOW, 0, NULL);
|
||||
|
||||
if (res) {
|
||||
OutputDebugString(L"PyShellExt::NotifyDragWindow - failed to post DDWM_UPDATEWINDOW");
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
public:
|
||||
// IDropTarget implementation
|
||||
|
||||
STDMETHODIMP DragEnter(IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect) {
|
||||
HWND hwnd;
|
||||
|
||||
OutputDebugString(L"PyShellExt::DragEnter");
|
||||
|
||||
pDataObj->AddRef();
|
||||
data_obj = pDataObj;
|
||||
|
||||
*pdwEffect = DROPEFFECT_MOVE;
|
||||
|
||||
if (FAILED(UpdateDropDescription(data_obj))) {
|
||||
OutputDebugString(L"PyShellExt::DragEnter - failed to update drop description");
|
||||
}
|
||||
if (FAILED(GetDragWindow(data_obj, &hwnd))) {
|
||||
OutputDebugString(L"PyShellExt::DragEnter - failed to get drag window");
|
||||
}
|
||||
if (FAILED(NotifyDragWindow(hwnd))) {
|
||||
OutputDebugString(L"PyShellExt::DragEnter - failed to notify drag window");
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP DragLeave() {
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP DragOver(DWORD grfKeyState, POINTL pt, DWORD *pdwEffect) {
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP Drop(IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect) {
|
||||
LPCWSTR args;
|
||||
|
||||
OutputDebugString(L"PyShellExt::Drop");
|
||||
*pdwEffect = DROPEFFECT_NONE;
|
||||
|
||||
if (pDataObj != data_obj) {
|
||||
OutputDebugString(L"PyShellExt::Drop - unexpected data object");
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
data_obj->Release();
|
||||
data_obj = NULL;
|
||||
|
||||
if (SUCCEEDED(GetArguments(pDataObj, &args))) {
|
||||
OutputDebugString(args);
|
||||
ShellExecute(NULL, NULL, target, args, target_dir, SW_NORMAL);
|
||||
|
||||
CoTaskMemFree((LPVOID)args);
|
||||
} else {
|
||||
OutputDebugString(L"PyShellExt::Drop - failed to get launch arguments");
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
// IPersistFile implementation
|
||||
|
||||
STDMETHODIMP GetCurFile(LPOLESTR *ppszFileName) {
|
||||
HRESULT hr;
|
||||
size_t len;
|
||||
|
||||
if (!ppszFileName) {
|
||||
return E_POINTER;
|
||||
}
|
||||
|
||||
hr = StringCchLength(target, STRSAFE_MAX_CCH - 1, &len);
|
||||
if (FAILED(hr)) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
*ppszFileName = (LPOLESTR)CoTaskMemAlloc(sizeof(WCHAR) * (len + 1));
|
||||
if (!*ppszFileName) {
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
hr = StringCchCopy(*ppszFileName, len + 1, target);
|
||||
if (FAILED(hr)) {
|
||||
CoTaskMemFree(*ppszFileName);
|
||||
*ppszFileName = NULL;
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP IsDirty() {
|
||||
return S_FALSE;
|
||||
}
|
||||
|
||||
STDMETHODIMP Load(LPCOLESTR pszFileName, DWORD dwMode) {
|
||||
HRESULT hr;
|
||||
size_t len;
|
||||
|
||||
OutputDebugString(L"PyShellExt::Load");
|
||||
OutputDebugString(pszFileName);
|
||||
|
||||
hr = StringCchLength(pszFileName, STRSAFE_MAX_CCH - 1, &len);
|
||||
if (FAILED(hr)) {
|
||||
OutputDebugString(L"PyShellExt::Load - failed to get string length");
|
||||
return hr;
|
||||
}
|
||||
|
||||
if (target) {
|
||||
CoTaskMemFree(target);
|
||||
}
|
||||
if (target_dir) {
|
||||
CoTaskMemFree(target_dir);
|
||||
}
|
||||
|
||||
target = (LPOLESTR)CoTaskMemAlloc(sizeof(WCHAR) * (len + 1));
|
||||
if (!target) {
|
||||
OutputDebugString(L"PyShellExt::Load - E_OUTOFMEMORY");
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
target_dir = (LPOLESTR)CoTaskMemAlloc(sizeof(WCHAR) * (len + 1));
|
||||
if (!target_dir) {
|
||||
OutputDebugString(L"PyShellExt::Load - E_OUTOFMEMORY");
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
hr = StringCchCopy(target, len + 1, pszFileName);
|
||||
if (FAILED(hr)) {
|
||||
OutputDebugString(L"PyShellExt::Load - failed to copy string");
|
||||
return hr;
|
||||
}
|
||||
|
||||
hr = StringCchCopy(target_dir, len + 1, pszFileName);
|
||||
if (FAILED(hr)) {
|
||||
OutputDebugString(L"PyShellExt::Load - failed to copy string");
|
||||
return hr;
|
||||
}
|
||||
if (!PathRemoveFileSpecW(target_dir)) {
|
||||
OutputDebugStringW(L"PyShellExt::Load - failed to remove filespec from target");
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
OutputDebugString(target);
|
||||
target_mode = dwMode;
|
||||
OutputDebugString(L"PyShellExt::Load - S_OK");
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP Save(LPCOLESTR pszFileName, BOOL fRemember) {
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
STDMETHODIMP SaveCompleted(LPCOLESTR pszFileName) {
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
STDMETHODIMP GetClassID(CLSID *pClassID) {
|
||||
*pClassID = CLSID_PyShellExt;
|
||||
return S_OK;
|
||||
}
|
||||
};
|
||||
|
||||
CoCreatableClass(PyShellExt);
|
||||
|
||||
STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, _COM_Outptr_ void** ppv) {
|
||||
return Module<InProc>::GetModule().GetClassObject(rclsid, riid, ppv);
|
||||
}
|
||||
|
||||
STDAPI DllCanUnloadNow() {
|
||||
return Module<InProc>::GetModule().Terminate() ? S_OK : S_FALSE;
|
||||
}
|
||||
|
||||
STDAPI DllRegisterServer() {
|
||||
LONG res;
|
||||
SECURITY_ATTRIBUTES secattr = { sizeof(SECURITY_ATTRIBUTES), NULL, FALSE };
|
||||
LPSECURITY_ATTRIBUTES psecattr = NULL;
|
||||
HKEY key, ipsKey;
|
||||
WCHAR modname[MAX_PATH];
|
||||
DWORD modname_len;
|
||||
|
||||
OutputDebugString(L"PyShellExt::DllRegisterServer");
|
||||
if (!hModule) {
|
||||
OutputDebugString(L"PyShellExt::DllRegisterServer - module handle was not set");
|
||||
return SELFREG_E_CLASS;
|
||||
}
|
||||
modname_len = GetModuleFileName(hModule, modname, MAX_PATH);
|
||||
if (modname_len == 0 ||
|
||||
(modname_len == MAX_PATH && GetLastError() == ERROR_INSUFFICIENT_BUFFER)) {
|
||||
OutputDebugString(L"PyShellExt::DllRegisterServer - failed to get module file name");
|
||||
return SELFREG_E_CLASS;
|
||||
}
|
||||
|
||||
DWORD disp;
|
||||
res = RegCreateKeyEx(HKEY_LOCAL_MACHINE, CLASS_SUBKEY, 0, NULL, 0,
|
||||
KEY_ALL_ACCESS, psecattr, &key, &disp);
|
||||
if (res == ERROR_ACCESS_DENIED) {
|
||||
OutputDebugString(L"PyShellExt::DllRegisterServer - failed to write per-machine registration. Attempting per-user instead.");
|
||||
res = RegCreateKeyEx(HKEY_CURRENT_USER, CLASS_SUBKEY, 0, NULL, 0,
|
||||
KEY_ALL_ACCESS, psecattr, &key, &disp);
|
||||
}
|
||||
if (res != ERROR_SUCCESS) {
|
||||
OutputDebugString(L"PyShellExt::DllRegisterServer - failed to create class key");
|
||||
return SELFREG_E_CLASS;
|
||||
}
|
||||
|
||||
res = RegCreateKeyEx(key, L"InProcServer32", 0, NULL, 0,
|
||||
KEY_ALL_ACCESS, psecattr, &ipsKey, NULL);
|
||||
if (res != ERROR_SUCCESS) {
|
||||
RegCloseKey(key);
|
||||
OutputDebugString(L"PyShellExt::DllRegisterServer - failed to create InProcServer32 key");
|
||||
return SELFREG_E_CLASS;
|
||||
}
|
||||
|
||||
res = RegSetValueEx(ipsKey, NULL, 0,
|
||||
REG_SZ, (LPBYTE)modname, modname_len * sizeof(modname[0]));
|
||||
|
||||
if (res != ERROR_SUCCESS) {
|
||||
RegCloseKey(ipsKey);
|
||||
RegCloseKey(key);
|
||||
OutputDebugString(L"PyShellExt::DllRegisterServer - failed to set server path");
|
||||
return SELFREG_E_CLASS;
|
||||
}
|
||||
|
||||
res = RegSetValueEx(ipsKey, L"ThreadingModel", 0,
|
||||
REG_SZ, (LPBYTE)(L"Apartment"), sizeof(L"Apartment"));
|
||||
|
||||
RegCloseKey(ipsKey);
|
||||
RegCloseKey(key);
|
||||
if (res != ERROR_SUCCESS) {
|
||||
OutputDebugString(L"PyShellExt::DllRegisterServer - failed to set threading model");
|
||||
return SELFREG_E_CLASS;
|
||||
}
|
||||
|
||||
SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, NULL, NULL);
|
||||
|
||||
OutputDebugString(L"PyShellExt::DllRegisterServer - S_OK");
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDAPI DllUnregisterServer() {
|
||||
LONG res_lm, res_cu;
|
||||
|
||||
res_lm = RegDeleteTree(HKEY_LOCAL_MACHINE, CLASS_SUBKEY);
|
||||
if (res_lm != ERROR_SUCCESS && res_lm != ERROR_FILE_NOT_FOUND) {
|
||||
OutputDebugString(L"PyShellExt::DllUnregisterServer - failed to delete per-machine registration");
|
||||
return SELFREG_E_CLASS;
|
||||
}
|
||||
|
||||
res_cu = RegDeleteTree(HKEY_CURRENT_USER, CLASS_SUBKEY);
|
||||
if (res_cu != ERROR_SUCCESS && res_cu != ERROR_FILE_NOT_FOUND) {
|
||||
OutputDebugString(L"PyShellExt::DllUnregisterServer - failed to delete per-user registration");
|
||||
return SELFREG_E_CLASS;
|
||||
}
|
||||
|
||||
if (res_lm == ERROR_FILE_NOT_FOUND && res_cu == ERROR_FILE_NOT_FOUND) {
|
||||
OutputDebugString(L"PyShellExt::DllUnregisterServer - extension was not registered");
|
||||
return SELFREG_E_CLASS;
|
||||
}
|
||||
|
||||
SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, NULL, NULL);
|
||||
|
||||
OutputDebugString(L"PyShellExt::DllUnregisterServer - S_OK");
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDAPI_(BOOL) DllMain(_In_opt_ HINSTANCE hinst, DWORD reason, _In_opt_ void*) {
|
||||
if (reason == DLL_PROCESS_ATTACH) {
|
||||
hModule = hinst;
|
||||
|
||||
cfDropDescription = RegisterClipboardFormat(CFSTR_DROPDESCRIPTION);
|
||||
if (!cfDropDescription) {
|
||||
OutputDebugString(L"PyShellExt::DllMain - failed to get CFSTR_DROPDESCRIPTION format");
|
||||
}
|
||||
cfDragWindow = RegisterClipboardFormat(L"DragWindow");
|
||||
if (!cfDragWindow) {
|
||||
OutputDebugString(L"PyShellExt::DllMain - failed to get DragWindow format");
|
||||
}
|
||||
|
||||
DisableThreadLibraryCalls(hinst);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
6
third_party/python/PC/pyshellext.def
vendored
|
@ -1,6 +0,0 @@
|
|||
LIBRARY "pyshellext"
|
||||
EXPORTS
|
||||
DllRegisterServer PRIVATE
|
||||
DllUnregisterServer PRIVATE
|
||||
DllGetClassObject PRIVATE
|
||||
DllCanUnloadNow PRIVATE
|
12
third_party/python/PC/pyshellext.idl
vendored
|
@ -1,12 +0,0 @@
|
|||
import "ocidl.idl";
|
||||
|
||||
[uuid(44039A76-3BDD-41C1-A31B-71C00202CE81), version(1.0)]
|
||||
library PyShellExtLib
|
||||
{
|
||||
[uuid(BEA218D2-6950-497B-9434-61683EC065FE), version(1.0)]
|
||||
coclass PyShellExt
|
||||
{
|
||||
[default] interface IDropTarget;
|
||||
interface IPersistFile;
|
||||
}
|
||||
};
|
46
third_party/python/PC/pyshellext.rc
vendored
|
@ -1,46 +0,0 @@
|
|||
#include <windows.h>
|
||||
|
||||
#include "python_ver_rc.h"
|
||||
|
||||
// Include the manifest file that indicates we support all
|
||||
// current versions of Windows.
|
||||
#include <winuser.h>
|
||||
1 RT_MANIFEST "python.manifest"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Version
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION PYVERSION64
|
||||
PRODUCTVERSION PYVERSION64
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS VS_FF_DEBUG
|
||||
#else
|
||||
FILEFLAGS 0x0L
|
||||
#endif
|
||||
FILEOS VOS__WINDOWS32
|
||||
FILETYPE VFT_APP
|
||||
FILESUBTYPE 0x0L
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "000004b0"
|
||||
BEGIN
|
||||
VALUE "CompanyName", PYTHON_COMPANY "\0"
|
||||
VALUE "FileDescription", "Python\0"
|
||||
VALUE "FileVersion", PYTHON_VERSION
|
||||
VALUE "InternalName", "Python Launcher Shell Extension\0"
|
||||
VALUE "LegalCopyright", PYTHON_COPYRIGHT "\0"
|
||||
VALUE "OriginalFilename", "pyshellext" PYTHON_DEBUG_EXT ".dll\0"
|
||||
VALUE "ProductName", "Python\0"
|
||||
VALUE "ProductVersion", PYTHON_VERSION
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x0, 1200
|
||||
END
|
||||
END
|
6
third_party/python/PC/pyshellext_d.def
vendored
|
@ -1,6 +0,0 @@
|
|||
LIBRARY "pyshellext_d"
|
||||
EXPORTS
|
||||
DllRegisterServer PRIVATE
|
||||
DllUnregisterServer PRIVATE
|
||||
DllGetClassObject PRIVATE
|
||||
DllCanUnloadNow PRIVATE
|
30
third_party/python/PC/python.manifest
vendored
|
@ -1,30 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
|
||||
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<security>
|
||||
<requestedPrivileges>
|
||||
<requestedExecutionLevel level="asInvoker" uiAccess="false"/>
|
||||
</requestedPrivileges>
|
||||
</security>
|
||||
</trustInfo>
|
||||
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
|
||||
<application>
|
||||
<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
|
||||
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
|
||||
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
|
||||
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
|
||||
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
|
||||
</application>
|
||||
</compatibility>
|
||||
<application xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<windowsSettings>
|
||||
<longPathAware xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">true</longPathAware>
|
||||
</windowsSettings>
|
||||
</application>
|
||||
<dependency>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls"
|
||||
version="6.0.0.0" processorArchitecture="*" publicKeyToken="6595b64144ccf1df" language="*" />
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
</assembly>
|
9
third_party/python/PC/python3dll.c
vendored
|
@ -1,9 +0,0 @@
|
|||
#include <windows.h>
|
||||
|
||||
BOOL WINAPI
|
||||
DllMain(HINSTANCE hInstDLL,
|
||||
DWORD fdwReason,
|
||||
LPVOID lpReserved)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
49
third_party/python/PC/python_exe.rc
vendored
|
@ -1,49 +0,0 @@
|
|||
// Resource script for Python console EXEs.
|
||||
|
||||
#include "python_ver_rc.h"
|
||||
|
||||
// Include the manifest file that indicates we support all
|
||||
// current versions of Windows.
|
||||
#include <winuser.h>
|
||||
1 RT_MANIFEST "python.manifest"
|
||||
|
||||
1 ICON DISCARDABLE "icons\python.ico"
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Version
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION PYVERSION64
|
||||
PRODUCTVERSION PYVERSION64
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS VS_FF_DEBUG
|
||||
#else
|
||||
FILEFLAGS 0x0L
|
||||
#endif
|
||||
FILEOS VOS__WINDOWS32
|
||||
FILETYPE VFT_APP
|
||||
FILESUBTYPE 0x0L
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "000004b0"
|
||||
BEGIN
|
||||
VALUE "CompanyName", PYTHON_COMPANY "\0"
|
||||
VALUE "FileDescription", "Python\0"
|
||||
VALUE "FileVersion", PYTHON_VERSION
|
||||
VALUE "InternalName", "Python Console\0"
|
||||
VALUE "LegalCopyright", PYTHON_COPYRIGHT "\0"
|
||||
VALUE "OriginalFilename", "python" PYTHON_DEBUG_EXT ".exe\0"
|
||||
VALUE "ProductName", "Python\0"
|
||||
VALUE "ProductVersion", PYTHON_VERSION
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x0, 1200
|
||||
END
|
||||
END
|
52
third_party/python/PC/python_nt.rc
vendored
|
@ -1,52 +0,0 @@
|
|||
// Resource script for Python core DLL.
|
||||
|
||||
#include "python_ver_rc.h"
|
||||
|
||||
// Include the manifest file that indicates we support all
|
||||
// current versions of Windows.
|
||||
#include <winuser.h>
|
||||
2 RT_MANIFEST "python.manifest"
|
||||
|
||||
// String Tables
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
1000, MS_DLL_ID
|
||||
END
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Version
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION PYVERSION64
|
||||
PRODUCTVERSION PYVERSION64
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS VS_FF_DEBUG
|
||||
#else
|
||||
FILEFLAGS 0x0L
|
||||
#endif
|
||||
FILEOS VOS__WINDOWS32
|
||||
FILETYPE VFT_DLL
|
||||
FILESUBTYPE 0x0L
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "000004b0"
|
||||
BEGIN
|
||||
VALUE "CompanyName", PYTHON_COMPANY "\0"
|
||||
VALUE "FileDescription", "Python Core\0"
|
||||
VALUE "FileVersion", PYTHON_VERSION
|
||||
VALUE "InternalName", "Python DLL\0"
|
||||
VALUE "LegalCopyright", PYTHON_COPYRIGHT "\0"
|
||||
VALUE "OriginalFilename", PYTHON_DLL_NAME "\0"
|
||||
VALUE "ProductName", "Python\0"
|
||||
VALUE "ProductVersion", PYTHON_VERSION
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x0, 1200
|
||||
END
|
||||
END
|
34
third_party/python/PC/python_ver_rc.h
vendored
|
@ -1,34 +0,0 @@
|
|||
// Resource script for Python core DLL.
|
||||
// Currently only holds version information.
|
||||
//
|
||||
#include "winver.h"
|
||||
|
||||
#define PYTHON_COMPANY "Python Software Foundation"
|
||||
#define PYTHON_COPYRIGHT "Copyright \xA9 2001-2021 Python Software Foundation. Copyright \xA9 2000 BeOpen.com. Copyright \xA9 1995-2001 CNRI. Copyright \xA9 1991-1995 SMC."
|
||||
|
||||
#define MS_WINDOWS
|
||||
#include "modsupport.h"
|
||||
#include "patchlevel.h"
|
||||
#include <pythonnt_rc.h>
|
||||
#ifdef _DEBUG
|
||||
# define PYTHON_DEBUG_EXT "_d"
|
||||
#else
|
||||
# define PYTHON_DEBUG_EXT
|
||||
#endif
|
||||
|
||||
/* e.g., 3.3.0a1
|
||||
* PY_VERSION comes from patchlevel.h
|
||||
*/
|
||||
#define PYTHON_VERSION PY_VERSION "\0"
|
||||
|
||||
/* 64-bit version number as comma-separated list of 4 16-bit ints */
|
||||
#if PY_MICRO_VERSION > 64
|
||||
# error "PY_MICRO_VERSION > 64"
|
||||
#endif
|
||||
#if PY_RELEASE_LEVEL > 99
|
||||
# error "PY_RELEASE_LEVEL > 99"
|
||||
#endif
|
||||
#if PY_RELEASE_SERIAL > 9
|
||||
# error "PY_RELEASE_SERIAL > 9"
|
||||
#endif
|
||||
#define PYVERSION64 PY_MAJOR_VERSION, PY_MINOR_VERSION, FIELD3, PYTHON_API_VERSION
|
49
third_party/python/PC/pythonw_exe.rc
vendored
|
@ -1,49 +0,0 @@
|
|||
// Resource script for Python console EXEs.
|
||||
|
||||
#include "python_ver_rc.h"
|
||||
|
||||
// Include the manifest file that indicates we support all
|
||||
// current versions of Windows.
|
||||
#include <winuser.h>
|
||||
1 RT_MANIFEST "python.manifest"
|
||||
|
||||
1 ICON DISCARDABLE "icons\pythonw.ico"
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Version
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION PYVERSION64
|
||||
PRODUCTVERSION PYVERSION64
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS VS_FF_DEBUG
|
||||
#else
|
||||
FILEFLAGS 0x0L
|
||||
#endif
|
||||
FILEOS VOS__WINDOWS32
|
||||
FILETYPE VFT_APP
|
||||
FILESUBTYPE 0x0L
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "000004b0"
|
||||
BEGIN
|
||||
VALUE "CompanyName", PYTHON_COMPANY "\0"
|
||||
VALUE "FileDescription", "Python\0"
|
||||
VALUE "FileVersion", PYTHON_VERSION
|
||||
VALUE "InternalName", "Python Application\0"
|
||||
VALUE "LegalCopyright", PYTHON_COPYRIGHT "\0"
|
||||
VALUE "OriginalFilename", "pythonw" PYTHON_DEBUG_EXT ".exe\0"
|
||||
VALUE "ProductName", "Python\0"
|
||||
VALUE "ProductVersion", PYTHON_VERSION
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x0, 1200
|
||||
END
|
||||
END
|
81
third_party/python/PC/readme.txt
vendored
|
@ -1,81 +0,0 @@
|
|||
Welcome to the "PC" subdirectory of the Python distribution
|
||||
***********************************************************
|
||||
|
||||
This "PC" subdirectory contains complete project files to make
|
||||
several older PC ports of Python, as well as all the PC-specific
|
||||
Python source files. It should be located in the root of the
|
||||
Python distribution, and there should be directories "Modules",
|
||||
"Objects", "Python", etc. in the parent directory of this "PC"
|
||||
subdirectory. Be sure to read the documentation in the Python
|
||||
distribution.
|
||||
|
||||
Python requires library files such as string.py to be available in
|
||||
one or more library directories. The search path of libraries is
|
||||
set up when Python starts. To see the current Python library search
|
||||
path, start Python and enter "import sys" and "print sys.path".
|
||||
|
||||
All PC ports use this scheme to try to set up a module search path:
|
||||
|
||||
1) The script location; the current directory without script.
|
||||
2) The PYTHONPATH variable, if set.
|
||||
3) For Win32 platforms (NT/95), paths specified in the Registry.
|
||||
4) Default directories lib, lib/win, lib/test, lib/tkinter;
|
||||
these are searched relative to the environment variable
|
||||
PYTHONHOME, if set, or relative to the executable and its
|
||||
ancestors, if a landmark file (Lib/string.py) is found ,
|
||||
or the current directory (not useful).
|
||||
5) The directory containing the executable.
|
||||
|
||||
The best installation strategy is to put the Python executable (and
|
||||
DLL, for Win32 platforms) in some convenient directory such as
|
||||
C:/python, and copy all library files and subdirectories (using XCOPY)
|
||||
to C:/python/lib. Then you don't need to set PYTHONPATH. Otherwise,
|
||||
set the environment variable PYTHONPATH to your Python search path.
|
||||
For example,
|
||||
set PYTHONPATH=.;d:\python\lib;d:\python\lib\win;d:\python\lib\dos-8x3
|
||||
|
||||
There are several add-in modules to build Python programs which use
|
||||
the native Windows operating environment. The ports here just make
|
||||
"QuickWin" and DOS Python versions which support a character-mode
|
||||
(console) environment. Look in www.python.org for Tkinter, PythonWin,
|
||||
WPY and wxPython.
|
||||
|
||||
To make a Python port, start the Integrated Development Environment
|
||||
(IDE) of your compiler, and read in the native "project file"
|
||||
(or makefile) provided. This will enable you to change any source
|
||||
files or build settings so you can make custom builds.
|
||||
|
||||
pyconfig.h An important configuration file specific to PC's.
|
||||
|
||||
config.c The list of C modules to include in the Python PC
|
||||
version. Manually edit this file to add or
|
||||
remove Python modules.
|
||||
|
||||
testpy.py A Python test program. Run this to test your
|
||||
Python port. It should produce copious output,
|
||||
ending in a report on how many tests were OK, how many
|
||||
failed, and how many were skipped. Don't worry about
|
||||
skipped tests (these test unavailable optional features).
|
||||
|
||||
|
||||
Additional files and subdirectories for 32-bit Windows
|
||||
======================================================
|
||||
|
||||
python_nt.rc Resource compiler input for python15.dll.
|
||||
|
||||
dl_nt.c
|
||||
Additional sources used for 32-bit Windows features.
|
||||
|
||||
getpathp.c Default sys.path calculations (for all PC platforms).
|
||||
|
||||
dllbase_nt.txt A (manually maintained) list of base addresses for
|
||||
various DLLs, to avoid run-time relocation.
|
||||
|
||||
|
||||
Note for Windows 3.x and DOS users
|
||||
==================================
|
||||
|
||||
Neither Windows 3.x nor DOS is supported any more. The last Python
|
||||
version that supported these was Python 1.5.2; the support files were
|
||||
present in Python 2.0 but weren't updated, and it is not our intention
|
||||
to support these platforms for Python 2.x.
|
49
third_party/python/PC/sqlite3.rc
vendored
|
@ -1,49 +0,0 @@
|
|||
// Resource script for Sqlite DLL.
|
||||
|
||||
#include <winver.h>
|
||||
|
||||
// Include the manifest file that indicates we support all
|
||||
// current versions of Windows.
|
||||
#include <winuser.h>
|
||||
2 RT_MANIFEST "python.manifest"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Version
|
||||
//
|
||||
|
||||
#define _S(x) #x
|
||||
#define S(x) _S(x)
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION SQLITE_MAJOR_VERSION, SQLITE_MINOR_VERSION, SQLITE_MICRO_VERSION, SQLITE_PATCH_VERSION
|
||||
PRODUCTVERSION SQLITE_MAJOR_VERSION, SQLITE_MINOR_VERSION, SQLITE_MICRO_VERSION, SQLITE_PATCH_VERSION
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS VS_FF_DEBUG
|
||||
#else
|
||||
FILEFLAGS 0x0L
|
||||
#endif
|
||||
FILEOS VOS__WINDOWS32
|
||||
FILETYPE VFT_DLL
|
||||
FILESUBTYPE 0x0L
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "000004b0"
|
||||
BEGIN
|
||||
VALUE "CompanyName", "SQLite3\0"
|
||||
VALUE "FileDescription", "SQLite3\0"
|
||||
VALUE "FileVersion", S(SQLITE_VERSION) "\0"
|
||||
VALUE "InternalName", "SQLite3 DLL\0"
|
||||
VALUE "LegalCopyright", "Unspecified\0"
|
||||
VALUE "OriginalFilename", "sqlite3.dll\0"
|
||||
VALUE "ProductName", "SQLite3\0"
|
||||
VALUE "ProductVersion", S(SQLITE_VERSION) "\0"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x0, 1200
|
||||
END
|
||||
END
|
89
third_party/python/PC/validate_ucrtbase.py
vendored
|
@ -1,89 +0,0 @@
|
|||
'''
|
||||
This script gets the version number from ucrtbased.dll and checks
|
||||
whether it is a version with a known issue.
|
||||
'''
|
||||
|
||||
import sys
|
||||
|
||||
from ctypes import (c_buffer, POINTER, byref, create_unicode_buffer,
|
||||
Structure, WinDLL)
|
||||
from ctypes.wintypes import DWORD, HANDLE
|
||||
|
||||
class VS_FIXEDFILEINFO(Structure):
|
||||
_fields_ = [
|
||||
("dwSignature", DWORD),
|
||||
("dwStrucVersion", DWORD),
|
||||
("dwFileVersionMS", DWORD),
|
||||
("dwFileVersionLS", DWORD),
|
||||
("dwProductVersionMS", DWORD),
|
||||
("dwProductVersionLS", DWORD),
|
||||
("dwFileFlagsMask", DWORD),
|
||||
("dwFileFlags", DWORD),
|
||||
("dwFileOS", DWORD),
|
||||
("dwFileType", DWORD),
|
||||
("dwFileSubtype", DWORD),
|
||||
("dwFileDateMS", DWORD),
|
||||
("dwFileDateLS", DWORD),
|
||||
]
|
||||
|
||||
kernel32 = WinDLL('kernel32')
|
||||
version = WinDLL('version')
|
||||
|
||||
if len(sys.argv) < 2:
|
||||
print('Usage: validate_ucrtbase.py <ucrtbase|ucrtbased>')
|
||||
sys.exit(2)
|
||||
|
||||
try:
|
||||
ucrtbased = WinDLL(sys.argv[1])
|
||||
except OSError:
|
||||
print('Cannot find ucrtbased.dll')
|
||||
# This likely means that VS is not installed, but that is an
|
||||
# obvious enough problem if you're trying to produce a debug
|
||||
# build that we don't need to fail here.
|
||||
sys.exit(0)
|
||||
|
||||
# We will immediately double the length up to MAX_PATH, but the
|
||||
# path may be longer, so we retry until the returned string is
|
||||
# shorter than our buffer.
|
||||
name_len = actual_len = 130
|
||||
while actual_len == name_len:
|
||||
name_len *= 2
|
||||
name = create_unicode_buffer(name_len)
|
||||
actual_len = kernel32.GetModuleFileNameW(HANDLE(ucrtbased._handle),
|
||||
name, len(name))
|
||||
if not actual_len:
|
||||
print('Failed to get full module name.')
|
||||
sys.exit(2)
|
||||
|
||||
size = version.GetFileVersionInfoSizeW(name, None)
|
||||
if not size:
|
||||
print('Failed to get size of version info.')
|
||||
sys.exit(2)
|
||||
|
||||
ver_block = c_buffer(size)
|
||||
if (not version.GetFileVersionInfoW(name, None, size, ver_block) or
|
||||
not ver_block):
|
||||
print('Failed to get version info.')
|
||||
sys.exit(2)
|
||||
|
||||
pvi = POINTER(VS_FIXEDFILEINFO)()
|
||||
if not version.VerQueryValueW(ver_block, "", byref(pvi), byref(DWORD())):
|
||||
print('Failed to get version value from info.')
|
||||
sys.exit(2)
|
||||
|
||||
ver = (
|
||||
pvi.contents.dwProductVersionMS >> 16,
|
||||
pvi.contents.dwProductVersionMS & 0xFFFF,
|
||||
pvi.contents.dwProductVersionLS >> 16,
|
||||
pvi.contents.dwProductVersionLS & 0xFFFF,
|
||||
)
|
||||
|
||||
print('{} is version {}.{}.{}.{}'.format(name.value, *ver))
|
||||
|
||||
if ver < (10, 0, 10586):
|
||||
print('WARN: ucrtbased contains known issues. '
|
||||
'Please update the Windows 10 SDK.')
|
||||
print('See:')
|
||||
print(' http://bugs.python.org/issue27705')
|
||||
print(' https://developer.microsoft.com/en-US/windows/downloads/windows-10-sdk')
|
||||
sys.exit(1)
|
8
third_party/python/PC/winreg.c
vendored
|
@ -1,3 +1,4 @@
|
|||
/* clang-format off */
|
||||
/*
|
||||
winreg.c
|
||||
|
||||
|
@ -12,9 +13,8 @@
|
|||
|
||||
*/
|
||||
|
||||
#include "Python.h"
|
||||
#include "structmember.h"
|
||||
#include "windows.h"
|
||||
#include "third_party/python/Include/Python.h"
|
||||
#include "third_party/python/Include/structmember.h"
|
||||
|
||||
static BOOL PyHKEY_AsHKEY(PyObject *ob, HKEY *pRes, BOOL bNoneOK);
|
||||
static BOOL clinic_HKEY_converter(PyObject *ob, void *p);
|
||||
|
@ -249,7 +249,7 @@ class self_return_converter(CReturnConverter):
|
|||
[python start generated code]*/
|
||||
/*[python end generated code: output=da39a3ee5e6b4b0d input=22f7aedc6d68e80e]*/
|
||||
|
||||
#include "clinic/winreg.c.h"
|
||||
#include "third_party/python/PC/clinic/winreg.inc"
|
||||
|
||||
/************************************************************************
|
||||
|
||||
|
|
7
third_party/python/PC/winsound.c
vendored
|
@ -1,3 +1,4 @@
|
|||
/* clang-format off */
|
||||
/* Author: Toby Dickenson <htrd90@zepler.org>
|
||||
*
|
||||
* Copyright (c) 1999 Toby Dickenson
|
||||
|
@ -35,9 +36,7 @@
|
|||
winsound.PlaySound(None, 0)
|
||||
*/
|
||||
|
||||
#include <Python.h>
|
||||
#include <windows.h>
|
||||
#include <mmsystem.h>
|
||||
#include "third_party/python/Include/Python.h"
|
||||
|
||||
PyDoc_STRVAR(sound_module_doc,
|
||||
"PlaySound(sound, flags) - play a sound\n"
|
||||
|
@ -59,7 +58,7 @@ module winsound
|
|||
[clinic start generated code]*/
|
||||
/*[clinic end generated code: output=da39a3ee5e6b4b0d input=a18401142d97b8d5]*/
|
||||
|
||||
#include "clinic/winsound.c.h"
|
||||
#include "third_party/python/PC/clinic/winsound.inc"
|
||||
|
||||
/*[clinic input]
|
||||
winsound.PlaySound
|
||||
|
|