diff --git a/.nuget/NuGet.Config b/.nuget/NuGet.Config deleted file mode 100644 index 6a318ad..0000000 --- a/.nuget/NuGet.Config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.nuget/NuGet.exe b/.nuget/NuGet.exe deleted file mode 100644 index 8dd7e45..0000000 Binary files a/.nuget/NuGet.exe and /dev/null differ diff --git a/.nuget/NuGet.targets b/.nuget/NuGet.targets deleted file mode 100644 index 428c8da..0000000 --- a/.nuget/NuGet.targets +++ /dev/null @@ -1,144 +0,0 @@ - - - - $(MSBuildProjectDirectory)\..\ - - - false - - - false - - - true - - - false - - - - - - - - - - - $([System.IO.Path]::Combine($(SolutionDir), ".nuget")) - - - - - $(SolutionDir).nuget - - - - $(MSBuildProjectDirectory)\packages.$(MSBuildProjectName.Replace(' ', '_')).config - $(MSBuildProjectDirectory)\packages.$(MSBuildProjectName).config - - - - $(MSBuildProjectDirectory)\packages.config - $(PackagesProjectConfig) - - - - - $(NuGetToolsPath)\NuGet.exe - @(PackageSource) - - "$(NuGetExePath)" - mono --runtime=v4.0.30319 "$(NuGetExePath)" - - $(TargetDir.Trim('\\')) - - -RequireConsent - -NonInteractive - - "$(SolutionDir) " - "$(SolutionDir)" - - - $(NuGetCommand) install "$(PackagesConfig)" -source "$(PackageSources)" $(NonInteractiveSwitch) $(RequireConsentSwitch) -solutionDir $(PaddedSolutionDir) - $(NuGetCommand) pack "$(ProjectPath)" -Properties "Configuration=$(Configuration);Platform=$(Platform)" $(NonInteractiveSwitch) -OutputDirectory "$(PackageOutputDir)" -symbols - - - - RestorePackages; - $(BuildDependsOn); - - - - - $(BuildDependsOn); - BuildPackage; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/.nuget/packages.config b/.nuget/packages.config deleted file mode 100644 index 2667fb0..0000000 --- a/.nuget/packages.config +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/nsis_setup/Include/HasAssembly.nsh b/nsis_setup/Include/HasAssembly.nsh deleted file mode 100644 index e679643..0000000 --- a/nsis_setup/Include/HasAssembly.nsh +++ /dev/null @@ -1,62 +0,0 @@ -!ifndef HASASSEMBLY_INCLUDED -!define HASASSEMBLY_INCLUDED -!verbose Push -!verbose 3 - -!include LogicLib.nsh -!include Util.nsh - -!macro _WinSxS_HasAssembly - /* - push 'msvcr80.dll' - push 'Microsoft.VC80.CRT,version="8.0.50727.42",type="win32",processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b"' - Call WinSxS_HasAssembly - pop $0 ;0 on fail, 1 if it is in WinSxS or 2 if LoadLibrary worked on pre xp (call GetDLLVersion to make sure if you require a minimum version) - */ - Exch $8 - Exch - Exch $7 - push $9 - StrCpy $9 0 - push $0 - push $R0 - push $R1 - ${If} ${AtLeastWinXP} - System::Call "sxs::CreateAssemblyCache(*i.R0,i0)i.r0" - ${If} $0 == 0 - System::Call '*(i 24,i0,l,i0,i0)i.R1' ;TODO,BUGBUG: check alloc success - System::Call `$R0->4(i 0,w '$8',i $R1)i.r0` ;IAssemblyCache::QueryAssemblyInfo - ${If} $0 == 0 - System::Call '*$R1(i,i.r0)' - IntOp $0 $0 & 1 ;ASSEMBLYINFO_FLAG_INSTALLED=1 - ${IfThen} $0 <> 0 ${|} StrCpy $9 1 ${|} - ${EndIf} - System::Free $R1 - System::Call $R0->2() ;IAssemblyCache::Release - ${EndIf} - ${Else} - System::Call kernel32::LoadLibrary(t"$7")i.r0 - ${If} $0 != 0 - StrCpy $9 2 - System::Call 'kernel32::FreeLibrary(i r0)' - ${EndIf} - ${EndIf} - pop $R1 - pop $R0 - pop $0 - Exch 2 - pop $8 - pop $7 - Exch $9 -!macroend - -Function WinSxS_HasAssembly - !insertmacro _WinSxS_HasAssembly -FunctionEnd - -Function un.WinSxS_HasAssembly - !insertmacro _WinSxS_HasAssembly -FunctionEnd - -!verbose Pop -!endif \ No newline at end of file diff --git a/nsis_setup/MUIOrangeVistaTheme/Clean/header-l-un.bmp b/nsis_setup/MUIOrangeVistaTheme/Clean/header-l-un.bmp deleted file mode 100644 index d7b8693..0000000 Binary files a/nsis_setup/MUIOrangeVistaTheme/Clean/header-l-un.bmp and /dev/null differ diff --git a/nsis_setup/MUIOrangeVistaTheme/Clean/header-l.bmp b/nsis_setup/MUIOrangeVistaTheme/Clean/header-l.bmp deleted file mode 100644 index 11be229..0000000 Binary files a/nsis_setup/MUIOrangeVistaTheme/Clean/header-l.bmp and /dev/null differ diff --git a/nsis_setup/MUIOrangeVistaTheme/Clean/installer.ico b/nsis_setup/MUIOrangeVistaTheme/Clean/installer.ico deleted file mode 100644 index 057f86c..0000000 Binary files a/nsis_setup/MUIOrangeVistaTheme/Clean/installer.ico and /dev/null differ diff --git a/nsis_setup/MUIOrangeVistaTheme/Clean/uninstaller.ico b/nsis_setup/MUIOrangeVistaTheme/Clean/uninstaller.ico deleted file mode 100644 index 7c1bc35..0000000 Binary files a/nsis_setup/MUIOrangeVistaTheme/Clean/uninstaller.ico and /dev/null differ diff --git a/nsis_setup/MUIOrangeVistaTheme/Clean/wizard-un.bmp b/nsis_setup/MUIOrangeVistaTheme/Clean/wizard-un.bmp deleted file mode 100644 index ea666ee..0000000 Binary files a/nsis_setup/MUIOrangeVistaTheme/Clean/wizard-un.bmp and /dev/null differ diff --git a/nsis_setup/MUIOrangeVistaTheme/Clean/wizard.bmp b/nsis_setup/MUIOrangeVistaTheme/Clean/wizard.bmp deleted file mode 100644 index 4cccb8f..0000000 Binary files a/nsis_setup/MUIOrangeVistaTheme/Clean/wizard.bmp and /dev/null differ diff --git a/nsis_setup/MUIOrangeVistaTheme/License.txt b/nsis_setup/MUIOrangeVistaTheme/License.txt deleted file mode 100644 index 5f775f3..0000000 --- a/nsis_setup/MUIOrangeVistaTheme/License.txt +++ /dev/null @@ -1,74 +0,0 @@ -Author: Manuel Lozano - 2007 - monki@monki.es - www.monki.es - -=================== - -Creative Commons Legal Code -Attribution-NoDerivs 3.0 Unported - - CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE LEGAL SERVICES. DISTRIBUTION OF THIS LICENSE DOES NOT CREATE AN ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES REGARDING THE INFORMATION PROVIDED, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM ITS USE. - -License - -THE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE TERMS OF THIS CREATIVE COMMONS PUBLIC LICENSE ("CCPL" OR "LICENSE"). THE WORK IS PROTECTED BY COPYRIGHT AND/OR OTHER APPLICABLE LAW. ANY USE OF THE WORK OTHER THAN AS AUTHORIZED UNDER THIS LICENSE OR COPYRIGHT LAW IS PROHIBITED. - -BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED HERE, YOU ACCEPT AND AGREE TO BE BOUND BY THE TERMS OF THIS LICENSE. TO THE EXTENT THIS LICENSE MAY BE CONSIDERED TO BE A CONTRACT, THE LICENSOR GRANTS YOU THE RIGHTS CONTAINED HERE IN CONSIDERATION OF YOUR ACCEPTANCE OF SUCH TERMS AND CONDITIONS. - -1. Definitions - - 1. "Adaptation" means a work based upon the Work, or upon the Work and other pre-existing works, such as a translation, adaptation, derivative work, arrangement of music or other alterations of a literary or artistic work, or phonogram or performance and includes cinematographic adaptations or any other form in which the Work may be recast, transformed, or adapted including in any form recognizably derived from the original, except that a work that constitutes a Collection will not be considered an Adaptation for the purpose of this License. For the avoidance of doubt, where the Work is a musical work, performance or phonogram, the synchronization of the Work in timed-relation with a moving image ("synching") will be considered an Adaptation for the purpose of this License. - 2. "Collection" means a collection of literary or artistic works, such as encyclopedias and anthologies, or performances, phonograms or broadcasts, or other works or subject matter other than works listed in Section 1(f) below, which, by reason of the selection and arrangement of their contents, constitute intellectual creations, in which the Work is included in its entirety in unmodified form along with one or more other contributions, each constituting separate and independent works in themselves, which together are assembled into a collective whole. A work that constitutes a Collection will not be considered an Adaptation (as defined above) for the purposes of this License. - 3. "Distribute" means to make available to the public the original and copies of the Work through sale or other transfer of ownership. - 4. "Licensor" means the individual, individuals, entity or entities that offer(s) the Work under the terms of this License. - 5. "Original Author" means, in the case of a literary or artistic work, the individual, individuals, entity or entities who created the Work or if no individual or entity can be identified, the publisher; and in addition (i) in the case of a performance the actors, singers, musicians, dancers, and other persons who act, sing, deliver, declaim, play in, interpret or otherwise perform literary or artistic works or expressions of folklore; (ii) in the case of a phonogram the producer being the person or legal entity who first fixes the sounds of a performance or other sounds; and, (iii) in the case of broadcasts, the organization that transmits the broadcast. - 6. "Work" means the literary and/or artistic work offered under the terms of this License including without limitation any production in the literary, scientific and artistic domain, whatever may be the mode or form of its expression including digital form, such as a book, pamphlet and other writing; a lecture, address, sermon or other work of the same nature; a dramatic or dramatico-musical work; a choreographic work or entertainment in dumb show; a musical composition with or without words; a cinematographic work to which are assimilated works expressed by a process analogous to cinematography; a work of drawing, painting, architecture, sculpture, engraving or lithography; a photographic work to which are assimilated works expressed by a process analogous to photography; a work of applied art; an illustration, map, plan, sketch or three-dimensional work relative to geography, topography, architecture or science; a performance; a broadcast; a phonogram; a compilation of data to the extent it is protected as a copyrightable work; or a work performed by a variety or circus performer to the extent it is not otherwise considered a literary or artistic work. - 7. "You" means an individual or entity exercising rights under this License who has not previously violated the terms of this License with respect to the Work, or who has received express permission from the Licensor to exercise rights under this License despite a previous violation. - 8. "Publicly Perform" means to perform public recitations of the Work and to communicate to the public those public recitations, by any means or process, including by wire or wireless means or public digital performances; to make available to the public Works in such a way that members of the public may access these Works from a place and at a place individually chosen by them; to perform the Work to the public by any means or process and the communication to the public of the performances of the Work, including by public digital performance; to broadcast and rebroadcast the Work by any means including signs, sounds or images. - 9. "Reproduce" means to make copies of the Work by any means including without limitation by sound or visual recordings and the right of fixation and reproducing fixations of the Work, including storage of a protected performance or phonogram in digital form or other electronic medium. - -2. Fair Dealing Rights. Nothing in this License is intended to reduce, limit, or restrict any uses free from copyright or rights arising from limitations or exceptions that are provided for in connection with the copyright protection under copyright law or other applicable laws. - -3. License Grant. Subject to the terms and conditions of this License, Licensor hereby grants You a worldwide, royalty-free, non-exclusive, perpetual (for the duration of the applicable copyright) license to exercise the rights in the Work as stated below: - - 1. to Reproduce the Work, to incorporate the Work into one or more Collections, and to Reproduce the Work as incorporated in the Collections; and, - 2. to Distribute and Publicly Perform the Work including as incorporated in Collections. - 3. - - For the avoidance of doubt: - 1. Non-waivable Compulsory License Schemes. In those jurisdictions in which the right to collect royalties through any statutory or compulsory licensing scheme cannot be waived, the Licensor reserves the exclusive right to collect such royalties for any exercise by You of the rights granted under this License; - 2. Waivable Compulsory License Schemes. In those jurisdictions in which the right to collect royalties through any statutory or compulsory licensing scheme can be waived, the Licensor waives the exclusive right to collect such royalties for any exercise by You of the rights granted under this License; and, - 3. Voluntary License Schemes. The Licensor waives the right to collect royalties, whether individually or, in the event that the Licensor is a member of a collecting society that administers voluntary licensing schemes, via that society, from any exercise by You of the rights granted under this License. - -The above rights may be exercised in all media and formats whether now known or hereafter devised. The above rights include the right to make such modifications as are technically necessary to exercise the rights in other media and formats, but otherwise you have no rights to make Adaptations. Subject to Section 8(f), all rights not expressly granted by Licensor are hereby reserved. - -4. Restrictions. The license granted in Section 3 above is expressly made subject to and limited by the following restrictions: - - 1. You may Distribute or Publicly Perform the Work only under the terms of this License. You must include a copy of, or the Uniform Resource Identifier (URI) for, this License with every copy of the Work You Distribute or Publicly Perform. You may not offer or impose any terms on the Work that restrict the terms of this License or the ability of the recipient of the Work to exercise the rights granted to that recipient under the terms of the License. You may not sublicense the Work. You must keep intact all notices that refer to this License and to the disclaimer of warranties with every copy of the Work You Distribute or Publicly Perform. When You Distribute or Publicly Perform the Work, You may not impose any effective technological measures on the Work that restrict the ability of a recipient of the Work from You to exercise the rights granted to that recipient under the terms of the License. This Section 4(a) applies to the Work as incorporated in a Collection, but this does not require the Collection apart from the Work itself to be made subject to the terms of this License. If You create a Collection, upon notice from any Licensor You must, to the extent practicable, remove from the Collection any credit as required by Section 4(b), as requested. - 2. If You Distribute, or Publicly Perform the Work or Collections, You must, unless a request has been made pursuant to Section 4(a), keep intact all copyright notices for the Work and provide, reasonable to the medium or means You are utilizing: (i) the name of the Original Author (or pseudonym, if applicable) if supplied, and/or if the Original Author and/or Licensor designate another party or parties (e.g., a sponsor institute, publishing entity, journal) for attribution ("Attribution Parties") in Licensor's copyright notice, terms of service or by other reasonable means, the name of such party or parties; (ii) the title of the Work if supplied; (iii) to the extent reasonably practicable, the URI, if any, that Licensor specifies to be associated with the Work, unless such URI does not refer to the copyright notice or licensing information for the Work. The credit required by this Section 4(b) may be implemented in any reasonable manner; provided, however, that in the case of a Collection, at a minimum such credit will appear, if a credit for all contributing authors of the Collection appears, then as part of these credits and in a manner at least as prominent as the credits for the other contributing authors. For the avoidance of doubt, You may only use the credit required by this Section for the purpose of attribution in the manner set out above and, by exercising Your rights under this License, You may not implicitly or explicitly assert or imply any connection with, sponsorship or endorsement by the Original Author, Licensor and/or Attribution Parties, as appropriate, of You or Your use of the Work, without the separate, express prior written permission of the Original Author, Licensor and/or Attribution Parties. - 3. Except as otherwise agreed in writing by the Licensor or as may be otherwise permitted by applicable law, if You Reproduce, Distribute or Publicly Perform the Work either by itself or as part of any Collections, You must not distort, mutilate, modify or take other derogatory action in relation to the Work which would be prejudicial to the Original Author's honor or reputation. - -5. Representations, Warranties and Disclaimer - -UNLESS OTHERWISE MUTUALLY AGREED TO BY THE PARTIES IN WRITING, LICENSOR OFFERS THE WORK AS-IS AND MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND CONCERNING THE WORK, EXPRESS, IMPLIED, STATUTORY OR OTHERWISE, INCLUDING, WITHOUT LIMITATION, WARRANTIES OF TITLE, MERCHANTIBILITY, FITNESS FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR THE ABSENCE OF LATENT OR OTHER DEFECTS, ACCURACY, OR THE PRESENCE OF ABSENCE OF ERRORS, WHETHER OR NOT DISCOVERABLE. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OF IMPLIED WARRANTIES, SO SUCH EXCLUSION MAY NOT APPLY TO YOU. - -6. Limitation on Liability. EXCEPT TO THE EXTENT REQUIRED BY APPLICABLE LAW, IN NO EVENT WILL LICENSOR BE LIABLE TO YOU ON ANY LEGAL THEORY FOR ANY SPECIAL, INCIDENTAL, CONSEQUENTIAL, PUNITIVE OR EXEMPLARY DAMAGES ARISING OUT OF THIS LICENSE OR THE USE OF THE WORK, EVEN IF LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - -7. Termination - - 1. This License and the rights granted hereunder will terminate automatically upon any breach by You of the terms of this License. Individuals or entities who have received Collections from You under this License, however, will not have their licenses terminated provided such individuals or entities remain in full compliance with those licenses. Sections 1, 2, 5, 6, 7, and 8 will survive any termination of this License. - 2. Subject to the above terms and conditions, the license granted here is perpetual (for the duration of the applicable copyright in the Work). Notwithstanding the above, Licensor reserves the right to release the Work under different license terms or to stop distributing the Work at any time; provided, however that any such election will not serve to withdraw this License (or any other license that has been, or is required to be, granted under the terms of this License), and this License will continue in full force and effect unless terminated as stated above. - -8. Miscellaneous - - 1. Each time You Distribute or Publicly Perform the Work or a Collection, the Licensor offers to the recipient a license to the Work on the same terms and conditions as the license granted to You under this License. - 2. If any provision of this License is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this License, and without further action by the parties to this agreement, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable. - 3. No term or provision of this License shall be deemed waived and no breach consented to unless such waiver or consent shall be in writing and signed by the party to be charged with such waiver or consent. - 4. This License constitutes the entire agreement between the parties with respect to the Work licensed here. There are no understandings, agreements or representations with respect to the Work not specified here. Licensor shall not be bound by any additional provisions that may appear in any communication from You. This License may not be modified without the mutual written agreement of the Licensor and You. - 5. The rights granted under, and the subject matter referenced, in this License were drafted utilizing the terminology of the Berne Convention for the Protection of Literary and Artistic Works (as amended on September 28, 1979), the Rome Convention of 1961, the WIPO Copyright Treaty of 1996, the WIPO Performances and Phonograms Treaty of 1996 and the Universal Copyright Convention (as revised on July 24, 1971). These rights and subject matter take effect in the relevant jurisdiction in which the License terms are sought to be enforced according to the corresponding provisions of the implementation of those treaty provisions in the applicable national law. If the standard suite of rights granted under applicable copyright law includes additional rights not granted under this License, such additional rights are deemed to be included in the License; this License is not intended to restrict the license of any rights under applicable law. - - Creative Commons Notice - - Creative Commons is not a party to this License, and makes no warranty whatsoever in connection with the Work. Creative Commons will not be liable to You or any party on any legal theory for any damages whatsoever, including without limitation any general, special, incidental or consequential damages arising in connection to this license. Notwithstanding the foregoing two (2) sentences, if Creative Commons has expressly identified itself as the Licensor hereunder, it shall have all rights and obligations of Licensor. - - Except for the limited purpose of indicating to the public that the Work is licensed under the CCPL, Creative Commons does not authorize the use by either party of the trademark "Creative Commons" or any related trademark or logo of Creative Commons without the prior written consent of Creative Commons. Any permitted use will be in compliance with Creative Commons' then-current trademark usage guidelines, as may be published on its website or otherwise made available upon request from time to time. For the avoidance of doubt, this trademark restriction does not form part of this License. - - Creative Commons may be contacted at http://creativecommons.org/. diff --git a/nsis_setup/Plugins/inetc.dll b/nsis_setup/Plugins/inetc.dll deleted file mode 100644 index 89d989f..0000000 Binary files a/nsis_setup/Plugins/inetc.dll and /dev/null differ diff --git a/nsis_setup/pykd_license.txt b/nsis_setup/pykd_license.txt deleted file mode 100644 index 0218f75..0000000 --- a/nsis_setup/pykd_license.txt +++ /dev/null @@ -1,31 +0,0 @@ -Microsoft Public License (Ms-PL) - -This license governs use of the accompanying software. If you use the software, you accept this license. If you do not accept the license, do not use the software. - -1. Definitions - -The terms "reproduce," "reproduction," "derivative works," and "distribution" have the same meaning here as under U.S. copyright law. - -A "contribution" is the original software, or any additions or changes to the software. - -A "contributor" is any person that distributes its contribution under this license. - -"Licensed patents" are a contributor's patent claims that read directly on its contribution. - -2. Grant of Rights - -(A) Copyright Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free copyright license to reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution or any derivative works that you create. - -(B) Patent Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free license under its licensed patents to make, have made, use, sell, offer for sale, import, and/or otherwise dispose of its contribution in the software or derivative works of the contribution in the software. - -3. Conditions and Limitations - -(A) No Trademark License- This license does not grant you rights to use any contributors' name, logo, or trademarks. - -(B) If you bring a patent claim against any contributor over patents that you claim are infringed by the software, your patent license from such contributor to the software ends automatically. - -(C) If you distribute any portion of the software, you must retain all copyright, patent, trademark, and attribution notices that are present in the software. - -(D) If you distribute any portion of the software in source code form, you may do so only under this license by including a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or object code form, you may only do so under a license that complies with this license. - -(E) The software is licensed "as-is." You bear the risk of using it. The contributors give no express warranties, guarantees or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the extent permitted under your local laws, the contributors exclude the implied warranties of merchantability, fitness for a particular purpose and non-infringement. \ No newline at end of file diff --git a/nsis_setup/pykd_logo.png b/nsis_setup/pykd_logo.png deleted file mode 100644 index 19c304c..0000000 Binary files a/nsis_setup/pykd_logo.png and /dev/null differ diff --git a/nsis_setup/pykd_setup_common.nsh b/nsis_setup/pykd_setup_common.nsh deleted file mode 100644 index 2425355..0000000 --- a/nsis_setup/pykd_setup_common.nsh +++ /dev/null @@ -1,483 +0,0 @@ -# -# This is setup script for pykd project. -# Author: Maksim K. aka airmax -# - -SetCompressor LZMA - -# Modern interface settings -!include "MUI2.nsh" -!include "LogicLib.nsh" -!include "WinVer.nsh" -!include "FileFunc.nsh" -!include "x64.nsh" -!include "Sections.nsh" - -!addincludedir .\Include -!addplugindir .\Plugins - -!include "HasAssembly.nsh" - -#------------------------------------------------------------------------------ -# General -#------------------------------------------------------------------------------ - -!define PRODUCT_SHORT_NAME "pykd" -!define PRODUCT_FULL_NAME "Python extension for WinDbg" -!define PRODUCT_VERSION "0.3.0.4" -!define PRODUCT_URL "http://pykd.codeplex.com/" -!define PRODUCT_NAME_AND_VERSION "${PRODUCT_FULL_NAME} ${PRODUCT_ARCH} ${PRODUCT_VERSION}" -!define PRODUCT_MANUFACTURER "PyKd Team" - -!if ${PRODUCT_ARCH} == "x64" - !define ARCH "amd64" -!else - !define ARCH "x86" -!endif - -!define BINARIES_DIR "${PRODUCT_SHORT_NAME}-${PRODUCT_VERSION}-python-${PYTHON_VERSION}\${PRODUCT_ARCH}" - -# Main Install settings -Name "${PRODUCT_NAME_AND_VERSION}" -OutFile "${PRODUCT_SHORT_NAME}-${PRODUCT_VERSION}-${PRODUCT_ARCH}-python-${PYTHON_VERSION}-setup.exe" - -BrandingText "${PRODUCT_FULL_NAME}" - -#Request application privileges for Windows Vista and 7 -RequestExecutionLevel admin - -ShowInstDetails show -ShowUninstDetails show - -#------------------------------------------------------------------------------ -# Variables -#------------------------------------------------------------------------------ - -#------------------------------------------------------------------------------ -# Interface Settings -#------------------------------------------------------------------------------ -!define MUI_ABORTWARNING - -!define MUI_ICON "MUIOrangeVistaTheme\Clean\installer.ico" -!define MUI_UNICON "MUIOrangeVistaTheme\Clean\uninstaller.ico" - -!define MUI_HEADERIMAGE -!define MUI_HEADERIMAGE_BITMAP "MUIOrangeVistaTheme\Clean\header-l.bmp" -!define MUI_HEADERIMAGE_UNBITMAP "MUIOrangeVistaTheme\Clean\header-l-un.bmp" - -!define MUI_WELCOMEPAGE_TITLE_3LINES -!define MUI_WELCOMEFINISHPAGE_BITMAP "MUIOrangeVistaTheme\Clean\wizard.bmp" - -!define MUI_DIRECTORYPAGE_TEXT_TOP "Please specify path to $\"winext$\" subfolder of Debugging Tools for Windows (${PRODUCT_ARCH})." -!define MUI_DIRECTORYPAGE_TEXT_DESTINATION "Debugging Tools for Windows (${PRODUCT_ARCH})\winext folder" - -!define MUI_FINISHPAGE_TITLE_3LINES -!define MUI_FINISHPAGE_TEXT_LARGE -!define MUI_FINISHPAGE_TEXT "${PRODUCT_NAME_AND_VERSION} was successfully installed.$\n$\n\ - Run WinDbg and type $\".load pykd.pyd$\" to start using it." - -!define MUI_FINISHPAGE_NOAUTOCLOSE - -!define MUI_COMPONENTSPAGE_SMALLDESC - -#------------------------------------------------------------------------------ -# Pages -#------------------------------------------------------------------------------ -# Installer Pages -!insertmacro MUI_PAGE_WELCOME -!insertmacro MUI_PAGE_LICENSE "pykd_license.txt" -!insertmacro MUI_PAGE_COMPONENTS -!insertmacro MUI_PAGE_DIRECTORY -!insertmacro MUI_PAGE_INSTFILES -!insertmacro MUI_PAGE_FINISH - -# Uninstaller Pages -#!insertmacro MUI_UNPAGE_CONFIRM -!insertmacro MUI_UNPAGE_COMPONENTS -!insertmacro MUI_UNPAGE_INSTFILES - -#------------------------------------------------------------------------------ -# Languages (first is default language) -#------------------------------------------------------------------------------ -!insertmacro MUI_LANGUAGE "English" -!insertmacro MUI_RESERVEFILE_LANGDLL - -#------------------------------------------------------------------------------ -# Installer file version information -#------------------------------------------------------------------------------ -VIProductVersion "${PRODUCT_VERSION}" -VIAddVersionKey /LANG=${LANG_ENGLISH} "ProductName" "${PRODUCT_SHORT_NAME}" -VIAddVersionKey /LANG=${LANG_ENGLISH} "Comments" "${PRODUCT_NAME_AND_VERSION}" -VIAddVersionKey /LANG=${LANG_ENGLISH} "CompanyName" "${PRODUCT_MANUFACTURER}" -VIAddVersionKey /LANG=${LANG_ENGLISH} "LegalTrademarks" "${PRODUCT_SHORT_NAME} is a trademark of ${PRODUCT_MANUFACTURER}" -VIAddVersionKey /LANG=${LANG_ENGLISH} "LegalCopyright" "© All rights reserved 2010-2014" -VIAddVersionKey /LANG=${LANG_ENGLISH} "FileDescription" "${PRODUCT_SHORT_NAME} setup" -VIAddVersionKey /LANG=${LANG_ENGLISH} "FileVersion" "${PRODUCT_VERSION}" - -#------------------------------------------------------------------------------ -# Some logic-lib like macro -#------------------------------------------------------------------------------ -!macro SetRegView64 - !if ${PRODUCT_ARCH} == "x64" - SetRegView 64 - !endif -!macroend -!define SetRegView64 "!insertmacro SetRegView64" - -!macro SetRegView32 - !if ${PRODUCT_ARCH} == "x64" - SetRegView 32 - !endif -!macroend -!define SetRegView32 "!insertmacro SetRegView32" - -!macro _IsVcRuntimeInstalled _a _b _t _f - !insertmacro _LOGICLIB_TEMP - Push 'msvcr90.dll' - Push 'Microsoft.VC90.CRT,version="9.0.21022.8",type="win32",processorArchitecture="${ARCH}",publicKeyToken="1fc8b3b9a1e18e3b"' - ${WinSxS_HasAssembly} - Pop $_LOGICLIB_TEMP - !insertmacro _== $_LOGICLIB_TEMP 1 `${_t}` `${_f}` -!macroend -!define IsVcRuntimeInstalled `"" IsVcRuntimeInstalled ""` -!define un.IsVcRuntimeInstalled `"" IsVcRuntimeInstalled ""` - -!macro _IsPythonInstalled _a _b _t _f - !insertmacro _LOGICLIB_TEMP - ${SetRegView64} - # Check Python ${PYTHON_VERSION} ${PRODUCT_ARCH}... - ReadRegStr $_LOGICLIB_TEMP HKLM "Software\Python\PythonCore\${PYTHON_VERSION}\InstallPath" "" - ${SetRegView32} - !insertmacro _!= $_LOGICLIB_TEMP "" `${_t}` `${_f}` -!macroend -!define IsPythonInstalled `"" IsPythonInstalled ""` -!define un.IsPythonInstalled `"" IsPythonInstalled ""` - -!macro _IsDiaRegistered _a _b _t _f - !insertmacro _LOGICLIB_TEMP - ${SetRegView64} - ReadRegStr $_LOGICLIB_TEMP HKCR "CLSID\${CLSID_DiaSource}\InprocServer32" "" - ${SetRegView32} - !insertmacro _!= $_LOGICLIB_TEMP "" `${_t}` `${_f}` -!macroend -!define IsDiaRegistered `"" IsDiaRegistered ""` -!define un.IsDiaRegistered `"" IsDiaRegistered ""` - -#------------------------------------------------------------------------------ -# Check WinDbg executable presence in selected directory -#------------------------------------------------------------------------------ -Function .onVerifyInstDir - ${IfNotThen} ${FileExists} "$INSTDIR\..\WinDbg.exe" ${|} Abort ${|} - - ${GetFileName} "$INSTDIR" $R0 - ${IfThen} $R0 != "WinExt" ${|} Abort ${|} -FunctionEnd - -#------------------------------------------------------------------------------ -# Installer Sections -#------------------------------------------------------------------------------ - -Section "${PRODUCT_SHORT_NAME} ${PRODUCT_ARCH}" sec_pykd - SectionIn RO - - # Set Section properties - SetOverwrite on - - # CURRENT USER - SetShellVarContext current - - DetailPrint "Extracting extension..." - SetOutPath "$INSTDIR" - - File ".\${BINARIES_DIR}\pykd.pyd" -SectionEnd - -Section "Snippets" sec_snippets - # Set Section properties - SetOverwrite on - - DetailPrint "Extracting snippets..." - SetOutPath "$DOCUMENTS\${PRODUCT_SHORT_NAME}\Snippets" - File "..\snippets\*.py" -SectionEnd - -Section "Samples" sec_samples - # Set Section properties - SetOverwrite on - - DetailPrint "Extracting samples..." - SetOutPath "$DOCUMENTS\${PRODUCT_SHORT_NAME}\Samples" - File /r "..\samples\*.py" -SectionEnd - -Section "Python ${PYTHON_VERSION} ${PRODUCT_ARCH}" sec_python - DetailPrint "Downloading Python..." - inetc::get /CAPTION "${PRODUCT_SHORT_NAME}" /QUESTION "" /POPUP "" /TIMEOUT=30000 "${PYTHON_URL_BASE}${PYTHON_INSTALLER}" "$TEMP\${PYTHON_INSTALLER}" /END - Pop $0 - ${If} $0 == "OK" - DetailPrint "Successfully downloaded." - DetailPrint "Installing Python..." - ClearErrors - ExecWait '"msiexec" /i "$TEMP\${PYTHON_INSTALLER}"' - IfErrors PythonInstallFailed - DetailPrint "Successfully installed." - ${SetRegView64} - WriteRegDWORD HKLM "Software\${PRODUCT_SHORT_NAME}" "UninstallPython" 1 - ${SetRegView32} - ${Else} - PythonInstallFailed: - DetailPrint "Operation failed. Installation will be continued without Python." - DetailPrint "Please download and install it manually:" - DetailPrint "${PYTHON_URL_BASE}${PYTHON_INSTALLER}" - ${EndIf} -SectionEnd - -Section "Visual C++ 2008 SP1 (${PRODUCT_ARCH}) runtime" sec_vcruntime - DetailPrint "Installing Microsoft Visual C++ 2008 SP1 (${PRODUCT_ARCH}) runtime library..." - - SetOutPath "$TEMP" - - File ".\${BINARIES_DIR}\vcredist_${PRODUCT_ARCH}.exe" - - ExecWait "$TEMP\vcredist_${PRODUCT_ARCH}.exe" - ${IfNot} ${Errors} - DetailPrint "Successfully installed." - ${SetRegView64} - WriteRegDWORD HKLM "Software\${PRODUCT_SHORT_NAME}" "UninstallVcRuntime" 1 - ${SetRegView32} - ${Else} - DetailPrint "Operation failed. Installation will be continued without Visual C++ runtime." - DetailPrint "Please download and install it manually." - ${EndIf} -SectionEnd - -Section "Debug Interface Access (${PRODUCT_ARCH}) library" sec_msdia - DetailPrint "Registering Debug Interface Access (${PRODUCT_ARCH}) library..." - - !if ${PRODUCT_ARCH} == "x64" - ${DisableX64FSRedirection} - ClearErrors - ExecWait '"$SYSDIR\regsvr32.exe" /s "$COMMONFILES64\Microsoft Shared\VC\${MSDIA_DLL_NAME}"' - ${EnableX64FSRedirection} - !else - RegDLL "$COMMONFILES\Microsoft Shared\VC\${MSDIA_DLL_NAME}" - !endif - - ${IfNot} ${Errors} - DetailPrint "Successfully registered." - ${SetRegView64} - WriteRegDWORD HKLM "Software\${PRODUCT_SHORT_NAME}" "UnregisterDia" 1 - ${SetRegView32} - ${Else} - DetailPrint "Operation failed. Please register it manually." - ${EndIf} -SectionEnd - -Section -FinishSection - ${SetRegView64} - DetailPrint "Storing installation folder..." - WriteRegStr HKLM "Software\${PRODUCT_SHORT_NAME}" "InstallPath" "$INSTDIR" - - DetailPrint "Adding extension dir and snippets dir to PYTHONPATH..." - WriteRegStr HKLM "Software\Python\PythonCore\${PYTHON_VERSION}\PythonPath\${PRODUCT_SHORT_NAME}" "" "$INSTDIR;$DOCUMENTS\${PRODUCT_SHORT_NAME}\Snippets;$DOCUMENTS\${PRODUCT_SHORT_NAME}\Samples" - - DetailPrint "Registering uninstaller..." - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_SHORT_NAME}" "DisplayName" "${PRODUCT_FULL_NAME} (${PRODUCT_ARCH})" - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_SHORT_NAME}" "UninstallString" "$LOCALAPPDATA\${PRODUCT_SHORT_NAME}\uninstall_${PRODUCT_ARCH}.exe" - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_SHORT_NAME}" "Publisher" "${PRODUCT_MANUFACTURER}" - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_SHORT_NAME}" "URLInfoAbout" "${PRODUCT_URL}" - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_SHORT_NAME}" "DisplayVersion" "${PRODUCT_VERSION}" - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_SHORT_NAME}" "DisplayIcon" "$LOCALAPPDATA\${PRODUCT_SHORT_NAME}\uninstall_${PRODUCT_ARCH}.exe" - ${SetRegView32} - - DetailPrint "Writing uninstaller..." - CreateDirectory "$LOCALAPPDATA\${PRODUCT_SHORT_NAME}" - WriteUninstaller "$LOCALAPPDATA\${PRODUCT_SHORT_NAME}\uninstall_${PRODUCT_ARCH}.exe" -SectionEnd - -#------------------------------------------------------------------------------ -# Before first page displayed -#------------------------------------------------------------------------------ - -# Workaround to allow ${IsVcRuntimeInstalled} work properly -!define WinSxS_HasAssembly `Call WinSxS_HasAssembly` - -Function .onInit - System::Call 'kernel32::CreateMutexA(i 0, i 0, t "${PRODUCT_SHORT_NAME}_${PRODUCT_ARCH}_setup") i .r1 ?e' - Pop $R0 - ${If} $R0 != 0 - MessageBox MB_OK|MB_ICONEXCLAMATION "The installer is already running." - Abort - ${EndIf} - - !if ${PRODUCT_ARCH} == "x64" - ${IfNot} ${RunningX64} - MessageBox MB_OK|MB_ICONEXCLAMATION "This installation requires 64-bit OS." - Abort - ${EndIf} - !endif - - ${SetRegView64} - # Get installation folder from registry if available - ReadRegStr $INSTDIR HKLM "Software\${PRODUCT_SHORT_NAME}" "InstallPath" - ${SetRegView32} - - ${If} ${IsPythonInstalled} - !insertmacro UnselectSection ${sec_python} - SectionSetText ${sec_python} "" - ${EndIf} - - ${If} ${IsVcRuntimeInstalled} - !insertmacro UnselectSection ${sec_vcruntime} - SectionSetText ${sec_vcruntime} "" - ${EndIf} - - ${If} ${IsDiaRegistered} - !insertmacro UnselectSection ${sec_msdia} - SectionSetText ${sec_msdia} "" - ${EndIf} -FunctionEnd - -#------------------------------------------------------------------------------ -# Installer sections descriptions -#------------------------------------------------------------------------------ - -LangString DESC_sec_pykd ${LANG_ENGLISH} "${PRODUCT_FULL_NAME}" -LangString DESC_sec_snippets ${LANG_ENGLISH} "Useful code snippets. Will be installed in $DOCUMENTS\${PRODUCT_SHORT_NAME}\Snippets" -LangString DESC_sec_samples ${LANG_ENGLISH} "Code samples. Will be installed in $DOCUMENTS\${PRODUCT_SHORT_NAME}\Samples" -LangString DESC_sec_python ${LANG_ENGLISH} "Let installer download and setup Python ${PYTHON_VERSION} ${PRODUCT_ARCH}" -LangString DESC_sec_vcruntime ${LANG_ENGLISH} "Let installer download and setup Microsoft Visual C++ 2008 SP1 (${PRODUCT_ARCH}) runtime library" -LangString DESC_sec_msdia ${LANG_ENGLISH} "Let installer register Debug Interface Access (${PRODUCT_ARCH}) library" - -!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN - !insertmacro MUI_DESCRIPTION_TEXT ${sec_pykd} $(DESC_sec_pykd) - !insertmacro MUI_DESCRIPTION_TEXT ${sec_snippets} $(DESC_sec_snippets) - !insertmacro MUI_DESCRIPTION_TEXT ${sec_samples} $(DESC_sec_samples) - !insertmacro MUI_DESCRIPTION_TEXT ${sec_python} $(DESC_sec_python) - !insertmacro MUI_DESCRIPTION_TEXT ${sec_vcruntime} $(DESC_sec_vcruntime) - !insertmacro MUI_DESCRIPTION_TEXT ${sec_msdia} $(DESC_sec_msdia) -!insertmacro MUI_FUNCTION_DESCRIPTION_END - -#------------------------------------------------------------------------------ -# Uninstaller sections -#------------------------------------------------------------------------------ -Section "un.${PRODUCT_SHORT_NAME} ${PRODUCT_ARCH}" unsec_pykd - SectionIn RO - - ${SetRegView64} - DetailPrint "Retriving installation folder from registry..." - ReadRegStr $INSTDIR HKLM "Software\${PRODUCT_SHORT_NAME}" "InstallPath" - - DetailPrint "Deleting extension dir and snippets dir from PYTHONPATH..." - DeleteRegKey HKLM "Software\Python\PythonCore\${PYTHON_VERSION}\PythonPath\${PRODUCT_SHORT_NAME}" - - DetailPrint "Unregistering uninstaller..." - DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_SHORT_NAME}" - ${SetRegView32} - - DetailPrint "Deleting extension..." - Delete "$INSTDIR\pykd.pyd" - - # Let user delete snippets himself - #RMDir "$DOCUMENTS\${PRODUCT_SHORT_NAME}" - - DetailPrint "Deleting uninstaller..." - Delete "$LOCALAPPDATA\${PRODUCT_SHORT_NAME}\uninstall_${PRODUCT_ARCH}.exe" - RMDir "$LOCALAPPDATA\${PRODUCT_SHORT_NAME}" -SectionEnd - -Section /o "un.Python ${PYTHON_VERSION} ${PRODUCT_ARCH}" unsec_python - DetailPrint "Uninstalling Python..." - ExecWait '"msiexec" /x ${PYTHON_PRODUCT_CODE}' -SectionEnd - -Section /o "un.Debug Interface Access (${PRODUCT_ARCH}) library" unsec_msdia - DetailPrint "Unregistering Debug Interface Access (${PRODUCT_ARCH}) library..." - ${SetRegView64} - ReadRegStr $R0 HKCR "CLSID\${CLSID_DiaSource}\InprocServer32" "" - ${SetRegView32} - - !if ${PRODUCT_ARCH} == "x64" - ${DisableX64FSRedirection} - ClearErrors - ExecWait '"$SYSDIR\regsvr32.exe" /s /u "$R0"' - ${EnableX64FSRedirection} - !else - UnRegDLL $R0 - !endif -SectionEnd - -Section /o "un.Visual C++ 2008 SP1 (${PRODUCT_ARCH}) runtime" unsec_vcruntime - DetailPrint "Uninstalling Microsoft Visual C++ 2008 SP1 (${PRODUCT_ARCH}) runtime library..." - ExecWait '"msiexec" /x ${VCRUNTIME_PRODUCT_CODE}' -SectionEnd - -Section -un.FinishSection - ${SetRegView64} - WriteRegDWORD HKLM "Software\${PRODUCT_SHORT_NAME}" "UninstallPython" 0 - WriteRegDWORD HKLM "Software\${PRODUCT_SHORT_NAME}" "UnregisterDia" 0 - WriteRegDWORD HKLM "Software\${PRODUCT_SHORT_NAME}" "UninstallVcRuntime" 0 -# DeleteRegValue HKLM "Software\${PRODUCT_SHORT_NAME}" "UninstallPython" -# DeleteRegValue HKLM "Software\${PRODUCT_SHORT_NAME}" "UnregisterDia" -# DeleteRegValue HKLM "Software\${PRODUCT_SHORT_NAME}" "UninstallVcRuntime" - ${SetRegView32} -SectionEnd - -#------------------------------------------------------------------------------ -# Before first page displayed -#------------------------------------------------------------------------------ - -# Workaround to allow ${IsVcRuntimeInstalled} work properly -!undef WinSxS_HasAssembly -!define WinSxS_HasAssembly `Call un.WinSxS_HasAssembly` - -Function un.onInit - ${SetRegView64} - ReadRegDWORD $R0 HKLM "Software\${PRODUCT_SHORT_NAME}" "UninstallPython" - ${SetRegView32} - - ${If} ${Errors} - ${OrIf} $R0 == 0 - #${OrIfNot} ${IsPythonInstalled} - !insertmacro UnselectSection ${unsec_python} - SectionSetText ${unsec_python} "" - ${EndIf} - - ${SetRegView64} - ReadRegDWORD $R0 HKLM "Software\${PRODUCT_SHORT_NAME}" "UnregisterDia" - ${SetRegView32} - - ${If} ${Errors} - ${OrIf} $R0 == 0 - #${OrIfNot} ${IsDiaRegistered} - !insertmacro UnselectSection ${unsec_msdia} - SectionSetText ${unsec_msdia} "" - ${EndIf} - - ${SetRegView64} - ReadRegDWORD $R0 HKLM "Software\${PRODUCT_SHORT_NAME}" "UninstallVcRuntime" - ${SetRegView32} - - ${If} ${Errors} - ${OrIf} $R0 == 0 - #${OrIfNot} ${IsVcRuntimeInstalled} - !insertmacro UnselectSection ${unsec_vcruntime} - SectionSetText ${unsec_vcruntime} "" - ${EndIf} -FunctionEnd - -#------------------------------------------------------------------------------ -# Uninstaller sections descriptions -#------------------------------------------------------------------------------ - -LangString DESC_unsec_pykd ${LANG_ENGLISH} "${PRODUCT_FULL_NAME}" -LangString DESC_unsec_python ${LANG_ENGLISH} "Uninstall Python ${PYTHON_VERSION} ${PRODUCT_ARCH}" -LangString DESC_unsec_msdia ${LANG_ENGLISH} "Unregister Debug Interface Access (${PRODUCT_ARCH}) library" -LangString DESC_unsec_vcruntime ${LANG_ENGLISH} "Uninstall Microsoft Visual C++ 2008 SP1 (${PRODUCT_ARCH}) runtime library" - -!insertmacro MUI_UNFUNCTION_DESCRIPTION_BEGIN - !insertmacro MUI_DESCRIPTION_TEXT ${unsec_pykd} $(DESC_unsec_pykd) - !insertmacro MUI_DESCRIPTION_TEXT ${unsec_python} $(DESC_unsec_python) - !insertmacro MUI_DESCRIPTION_TEXT ${unsec_msdia} $(DESC_unsec_msdia) - !insertmacro MUI_DESCRIPTION_TEXT ${unsec_vcruntime} $(DESC_unsec_vcruntime) -!insertmacro MUI_UNFUNCTION_DESCRIPTION_END diff --git a/nsis_setup/pykd_setup_x64.nsi b/nsis_setup/pykd_setup_x64.nsi deleted file mode 100644 index fa09e10..0000000 --- a/nsis_setup/pykd_setup_x64.nsi +++ /dev/null @@ -1,21 +0,0 @@ -# -# This is setup script for pykd project. -# Author: Maksim K. aka airmax -# - -!define PRODUCT_ARCH "x64" - -# When changing Python vesion don't forget to update ProductCode appropriately -!define PYTHON_VERSION "2.6" -!define PYTHON_URL_BASE "http://python.org/ftp/python/2.6.6/" -!define PYTHON_INSTALLER "python-2.6.6.amd64.msi" -!define PYTHON_PRODUCT_CODE "{6151CF20-0BD8-4023-A4A0-6A86DCFE58E6}" - -# When changing VC runtime vesion don't forget to update ProductCode appropriately -# VC9 (VS2008) SP1 + MFC Security Update -!define VCRUNTIME_PRODUCT_CODE "{5FCE6D76-F5DC-37AB-B2B8-22AB8CEDB1D4}" - -!define MSDIA_DLL_NAME "msdia90.dll" -!define CLSID_DiaSource "{4C41678E-887B-4365-A09E-925D28DB33C2}" - -!include "pykd_setup_common.nsh" diff --git a/nsis_setup/pykd_setup_x64_python27.nsi b/nsis_setup/pykd_setup_x64_python27.nsi deleted file mode 100644 index 7d41046..0000000 --- a/nsis_setup/pykd_setup_x64_python27.nsi +++ /dev/null @@ -1,21 +0,0 @@ -# -# This is setup script for pykd project. -# Author: Maksim K. aka airmax -# - -!define PRODUCT_ARCH "x64" - -# When changing Python vesion don't forget to update ProductCode appropriately -!define PYTHON_VERSION "2.7" -!define PYTHON_URL_BASE "http://python.org/ftp/python/2.7.3/" -!define PYTHON_INSTALLER "python-2.7.3.amd64.msi" -!define PYTHON_PRODUCT_CODE "{C0C31BCC-56FB-42A7-8766-D29E1BD74C7D}" - -# When changing VC runtime vesion don't forget to update ProductCode appropriately -# VC9 (VS2008) SP1 + MFC Security Update -!define VCRUNTIME_PRODUCT_CODE "{5FCE6D76-F5DC-37AB-B2B8-22AB8CEDB1D4}" - -!define MSDIA_DLL_NAME "msdia90.dll" -!define CLSID_DiaSource "{4C41678E-887B-4365-A09E-925D28DB33C2}" - -!include "pykd_setup_common.nsh" diff --git a/nsis_setup/pykd_setup_x86.nsi b/nsis_setup/pykd_setup_x86.nsi deleted file mode 100644 index 9261416..0000000 --- a/nsis_setup/pykd_setup_x86.nsi +++ /dev/null @@ -1,21 +0,0 @@ -# -# This is setup script for pykd project. -# Author: Maksim K. aka airmax -# - -!define PRODUCT_ARCH "x86" - -# When changing Python vesion don't forget to update ProductCode appropriately -!define PYTHON_VERSION "2.6" -!define PYTHON_URL_BASE "http://python.org/ftp/python/2.6.6/" -!define PYTHON_INSTALLER "python-2.6.6.msi" -!define PYTHON_PRODUCT_CODE "{6151CF20-0BD8-4023-A4A0-6A86DCFE58E5}" - -# When changing VC runtime vesion don't forget to update ProductCode appropriately -# VC9 (VS2008) SP1 + MFC Security Update -!define VCRUNTIME_PRODUCT_CODE "{9BE518E6-ECC6-35A9-88E4-87755C07200F}" - -!define MSDIA_DLL_NAME "msdia90.dll" -!define CLSID_DiaSource "{4C41678E-887B-4365-A09E-925D28DB33C2}" - -!include "pykd_setup_common.nsh" diff --git a/nsis_setup/pykd_setup_x86_python27.nsi b/nsis_setup/pykd_setup_x86_python27.nsi deleted file mode 100644 index 77ab6fd..0000000 --- a/nsis_setup/pykd_setup_x86_python27.nsi +++ /dev/null @@ -1,21 +0,0 @@ -# -# This is setup script for pykd project. -# Author: Maksim K. aka airmax -# - -!define PRODUCT_ARCH "x86" - -# When changing Python vesion don't forget to update ProductCode appropriately -!define PYTHON_VERSION "2.7" -!define PYTHON_URL_BASE "http://python.org/ftp/python/2.7.3/" -!define PYTHON_INSTALLER "python-2.7.3.msi" -!define PYTHON_PRODUCT_CODE "{C0C31BCC-56FB-42A7-8766-D29E1BD74C7C}" - -# When changing VC runtime vesion don't forget to update ProductCode appropriately -# VC9 (VS2008) SP1 + MFC Security Update -!define VCRUNTIME_PRODUCT_CODE "{9BE518E6-ECC6-35A9-88E4-87755C07200F}" - -!define MSDIA_DLL_NAME "msdia90.dll" -!define CLSID_DiaSource "{4C41678E-887B-4365-A09E-925D28DB33C2}" - -!include "pykd_setup_common.nsh" diff --git a/pykd-0.3-2010.sln b/pykd-0.3-2010.sln deleted file mode 100644 index 9db6b13..0000000 --- a/pykd-0.3-2010.sln +++ /dev/null @@ -1,119 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual Studio 2010 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pykd", "pykd\pykd.vcxproj", "{C4C45791-0201-4406-BC5C-A384B01E3BF5}" - ProjectSection(ProjectDependencies) = postProject - {0E4CC688-F2F5-499F-9C07-0F2CAEE0D3EF} = {0E4CC688-F2F5-499F-9C07-0F2CAEE0D3EF} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "kdlib", "kdlibcpp\source\kdlib.vcxproj", "{3E9C538F-F060-4E86-AB7D-D44439615B63}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{5A3C2DA6-AE91-4025-AC03-A58BD03CEBCD}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "scripts", "scripts", "{FE246107-1CB8-404F-97BD-E901E4B5E972}" - ProjectSection(SolutionItems) = preProject - test\scripts\_run_pykdtest.cmd = test\scripts\_run_pykdtest.cmd - test\scripts\basetest.py = test\scripts\basetest.py - test\scripts\breakpoint.py = test\scripts\breakpoint.py - test\scripts\clienttest.py = test\scripts\clienttest.py - test\scripts\customtypestest.py = test\scripts\customtypestest.py - test\scripts\dbgcmd.py = test\scripts\dbgcmd.py - test\scripts\ehexcepttest.py = test\scripts\ehexcepttest.py - test\scripts\ehloadtest.py = test\scripts\ehloadtest.py - test\scripts\ehstatustest.py = test\scripts\ehstatustest.py - test\scripts\ehsymbolstest.py = test\scripts\ehsymbolstest.py - test\scripts\eventtest.py = test\scripts\eventtest.py - test\scripts\intbase.py = test\scripts\intbase.py - test\scripts\localstest.py = test\scripts\localstest.py - test\scripts\memtest.py = test\scripts\memtest.py - test\scripts\moduletest.py = test\scripts\moduletest.py - test\scripts\mspdbtest.py = test\scripts\mspdbtest.py - test\scripts\pykdtest.py = test\scripts\pykdtest.py - test\scripts\regtest.py = test\scripts\regtest.py - test\scripts\stacktest.py = test\scripts\stacktest.py - test\scripts\synsymtest.py = test\scripts\synsymtest.py - test\scripts\target.py = test\scripts\target.py - test\scripts\testutils.py = test\scripts\testutils.py - test\scripts\thrdctxtest.py = test\scripts\thrdctxtest.py - test\scripts\typedvar.py = test\scripts\typedvar.py - test\scripts\typeinfo.py = test\scripts\typeinfo.py - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "targetapp", "kdlibcpp\tests\targetapp\targetapp.vcxproj", "{0E4CC688-F2F5-499F-9C07-0F2CAEE0D3EF}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{A7AF87D2-983B-4B3A-823F-5A2C6989672E}" - ProjectSection(SolutionItems) = preProject - samples\samples.py = samples\samples.py - EndProjectSection -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "snippets", "snippets", "{AAB21DD2-B0EE-493E-8415-5195F18879EB}" - ProjectSection(SolutionItems) = preProject - snippets\accessmask.py = snippets\accessmask.py - snippets\avl.py = snippets\avl.py - snippets\cr0.py = snippets\cr0.py - snippets\cr4.py = snippets\cr4.py - snippets\ctlcode.py = snippets\ctlcode.py - snippets\export.py = snippets\export.py - snippets\findhandle.py = snippets\findhandle.py - snippets\findtag.py = snippets\findtag.py - snippets\gdt.py = snippets\gdt.py - snippets\help.py = snippets\help.py - snippets\iat.py = snippets\iat.py - snippets\nbl.py = snippets\nbl.py - snippets\ndis.py = snippets\ndis.py - snippets\ntobj.py = snippets\ntobj.py - snippets\pytowiki.py = snippets\pytowiki.py - snippets\ssdt.py = snippets\ssdt.py - snippets\stkdelta.py = snippets\stkdelta.py - snippets\stkwalk.py = snippets\stkwalk.py - snippets\wfp.py = snippets\wfp.py - EndProjectSection -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "um", "um", "{EEFC9510-DFA7-439E-801E-48FCE72766AD}" - ProjectSection(SolutionItems) = preProject - samples\um\critlist.py = samples\um\critlist.py - samples\um\ldr.py = samples\um\ldr.py - EndProjectSection -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug_2.7|Win32 = Debug_2.7|Win32 - Debug_2.7|x64 = Debug_2.7|x64 - Release_2.7|Win32 = Release_2.7|Win32 - Release_2.7|x64 = Release_2.7|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {C4C45791-0201-4406-BC5C-A384B01E3BF5}.Debug_2.7|Win32.ActiveCfg = Debug_2.7|Win32 - {C4C45791-0201-4406-BC5C-A384B01E3BF5}.Debug_2.7|Win32.Build.0 = Debug_2.7|Win32 - {C4C45791-0201-4406-BC5C-A384B01E3BF5}.Debug_2.7|x64.ActiveCfg = Debug_2.7|x64 - {C4C45791-0201-4406-BC5C-A384B01E3BF5}.Debug_2.7|x64.Build.0 = Debug_2.7|x64 - {C4C45791-0201-4406-BC5C-A384B01E3BF5}.Release_2.7|Win32.ActiveCfg = Release_2.7|Win32 - {C4C45791-0201-4406-BC5C-A384B01E3BF5}.Release_2.7|Win32.Build.0 = Release_2.7|Win32 - {C4C45791-0201-4406-BC5C-A384B01E3BF5}.Release_2.7|x64.ActiveCfg = Release_2.7|x64 - {C4C45791-0201-4406-BC5C-A384B01E3BF5}.Release_2.7|x64.Build.0 = Release_2.7|x64 - {3E9C538F-F060-4E86-AB7D-D44439615B63}.Debug_2.7|Win32.ActiveCfg = Debug|Win32 - {3E9C538F-F060-4E86-AB7D-D44439615B63}.Debug_2.7|Win32.Build.0 = Debug|Win32 - {3E9C538F-F060-4E86-AB7D-D44439615B63}.Debug_2.7|x64.ActiveCfg = Debug|x64 - {3E9C538F-F060-4E86-AB7D-D44439615B63}.Debug_2.7|x64.Build.0 = Debug|x64 - {3E9C538F-F060-4E86-AB7D-D44439615B63}.Release_2.7|Win32.ActiveCfg = Release|Win32 - {3E9C538F-F060-4E86-AB7D-D44439615B63}.Release_2.7|Win32.Build.0 = Release|Win32 - {3E9C538F-F060-4E86-AB7D-D44439615B63}.Release_2.7|x64.ActiveCfg = Release|x64 - {3E9C538F-F060-4E86-AB7D-D44439615B63}.Release_2.7|x64.Build.0 = Release|x64 - {0E4CC688-F2F5-499F-9C07-0F2CAEE0D3EF}.Debug_2.7|Win32.ActiveCfg = Debug|Win32 - {0E4CC688-F2F5-499F-9C07-0F2CAEE0D3EF}.Debug_2.7|Win32.Build.0 = Debug|Win32 - {0E4CC688-F2F5-499F-9C07-0F2CAEE0D3EF}.Debug_2.7|x64.ActiveCfg = Debug|x64 - {0E4CC688-F2F5-499F-9C07-0F2CAEE0D3EF}.Debug_2.7|x64.Build.0 = Debug|x64 - {0E4CC688-F2F5-499F-9C07-0F2CAEE0D3EF}.Release_2.7|Win32.ActiveCfg = Release|Win32 - {0E4CC688-F2F5-499F-9C07-0F2CAEE0D3EF}.Release_2.7|Win32.Build.0 = Release|Win32 - {0E4CC688-F2F5-499F-9C07-0F2CAEE0D3EF}.Release_2.7|x64.ActiveCfg = Release|x64 - {0E4CC688-F2F5-499F-9C07-0F2CAEE0D3EF}.Release_2.7|x64.Build.0 = Release|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(NestedProjects) = preSolution - {FE246107-1CB8-404F-97BD-E901E4B5E972} = {5A3C2DA6-AE91-4025-AC03-A58BD03CEBCD} - {0E4CC688-F2F5-499F-9C07-0F2CAEE0D3EF} = {5A3C2DA6-AE91-4025-AC03-A58BD03CEBCD} - {EEFC9510-DFA7-439E-801E-48FCE72766AD} = {A7AF87D2-983B-4B3A-823F-5A2C6989672E} - EndGlobalSection -EndGlobal diff --git a/pykd-0.3-2012.sln b/pykd-0.3-2012.sln deleted file mode 100644 index c372868..0000000 --- a/pykd-0.3-2012.sln +++ /dev/null @@ -1,256 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2012 -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{5A3C2DA6-AE91-4025-AC03-A58BD03CEBCD}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{A7AF87D2-983B-4B3A-823F-5A2C6989672E}" - ProjectSection(SolutionItems) = preProject - samples\samples.py = samples\samples.py - EndProjectSection -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "snippets", "snippets", "{AAB21DD2-B0EE-493E-8415-5195F18879EB}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "um", "um", "{EEFC9510-DFA7-439E-801E-48FCE72766AD}" - ProjectSection(SolutionItems) = preProject - samples\um\critlist.py = samples\um\critlist.py - samples\um\ldr.py = samples\um\ldr.py - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "targetapp", "kdlibcpp\tests\targetapp\targetapp_vc110.vcxproj", "{0E4CC688-F2F5-499F-9C07-0F2CAEE0D3EF}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "kdlib", "kdlibcpp\source\kdlib_vc110.vcxproj", "{3E9C538F-F060-4E86-AB7D-D44439615B63}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pykd", "pykd\pykd_vc110.vcxproj", "{C4C45791-0201-4406-BC5C-A384B01E3BF5}" - ProjectSection(ProjectDependencies) = postProject - {0E4CC688-F2F5-499F-9C07-0F2CAEE0D3EF} = {0E4CC688-F2F5-499F-9C07-0F2CAEE0D3EF} - EndProjectSection -EndProject -Project("{888888A0-9F3D-457C-B088-3A5042F75D52}") = "pykdtest", "test\scripts\pykdtest.pyproj", "{3F0BE77E-19B0-4192-B432-44A25805BCB8}" - ProjectSection(ProjectDependencies) = postProject - {C4C45791-0201-4406-BC5C-A384B01E3BF5} = {C4C45791-0201-4406-BC5C-A384B01E3BF5} - EndProjectSection -EndProject -Project("{888888A0-9F3D-457C-B088-3A5042F75D52}") = "snippets", "snippets\snippets.pyproj", "{6471FEDC-3129-410F-BFFC-4BC89707E5EC}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{EFB54DEF-ABE9-48E0-8EFB-73CB55B18893}" -EndProject -Project("{888888A0-9F3D-457C-B088-3A5042F75D52}") = "setup", "setup\setup.pyproj", "{D78837DC-BF31-4FC4-88A5-7F2FADAFA795}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug_2.7|Any CPU = Debug_2.7|Any CPU - Debug_2.7|Mixed Platforms = Debug_2.7|Mixed Platforms - Debug_2.7|Win32 = Debug_2.7|Win32 - Debug_2.7|x64 = Debug_2.7|x64 - Debug|Any CPU = Debug|Any CPU - Debug|Mixed Platforms = Debug|Mixed Platforms - Debug|Win32 = Debug|Win32 - Debug|x64 = Debug|x64 - Release_2.7|Any CPU = Release_2.7|Any CPU - Release_2.7|Mixed Platforms = Release_2.7|Mixed Platforms - Release_2.7|Win32 = Release_2.7|Win32 - Release_2.7|x64 = Release_2.7|x64 - Release|Any CPU = Release|Any CPU - Release|Mixed Platforms = Release|Mixed Platforms - Release|Win32 = Release|Win32 - Release|x64 = Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {0E4CC688-F2F5-499F-9C07-0F2CAEE0D3EF}.Debug_2.7|Any CPU.ActiveCfg = Debug|Win32 - {0E4CC688-F2F5-499F-9C07-0F2CAEE0D3EF}.Debug_2.7|Mixed Platforms.ActiveCfg = Debug|Win32 - {0E4CC688-F2F5-499F-9C07-0F2CAEE0D3EF}.Debug_2.7|Mixed Platforms.Build.0 = Debug|Win32 - {0E4CC688-F2F5-499F-9C07-0F2CAEE0D3EF}.Debug_2.7|Mixed Platforms.Deploy.0 = Debug|Win32 - {0E4CC688-F2F5-499F-9C07-0F2CAEE0D3EF}.Debug_2.7|Win32.ActiveCfg = Debug|Win32 - {0E4CC688-F2F5-499F-9C07-0F2CAEE0D3EF}.Debug_2.7|Win32.Build.0 = Debug|Win32 - {0E4CC688-F2F5-499F-9C07-0F2CAEE0D3EF}.Debug_2.7|Win32.Deploy.0 = Debug|Win32 - {0E4CC688-F2F5-499F-9C07-0F2CAEE0D3EF}.Debug_2.7|x64.ActiveCfg = Debug|x64 - {0E4CC688-F2F5-499F-9C07-0F2CAEE0D3EF}.Debug_2.7|x64.Build.0 = Debug|x64 - {0E4CC688-F2F5-499F-9C07-0F2CAEE0D3EF}.Debug_2.7|x64.Deploy.0 = Debug|x64 - {0E4CC688-F2F5-499F-9C07-0F2CAEE0D3EF}.Debug|Any CPU.ActiveCfg = Debug|Win32 - {0E4CC688-F2F5-499F-9C07-0F2CAEE0D3EF}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 - {0E4CC688-F2F5-499F-9C07-0F2CAEE0D3EF}.Debug|Mixed Platforms.Build.0 = Debug|Win32 - {0E4CC688-F2F5-499F-9C07-0F2CAEE0D3EF}.Debug|Mixed Platforms.Deploy.0 = Debug|Win32 - {0E4CC688-F2F5-499F-9C07-0F2CAEE0D3EF}.Debug|Win32.ActiveCfg = Debug|Win32 - {0E4CC688-F2F5-499F-9C07-0F2CAEE0D3EF}.Debug|Win32.Build.0 = Debug|Win32 - {0E4CC688-F2F5-499F-9C07-0F2CAEE0D3EF}.Debug|Win32.Deploy.0 = Debug|Win32 - {0E4CC688-F2F5-499F-9C07-0F2CAEE0D3EF}.Debug|x64.ActiveCfg = Debug|x64 - {0E4CC688-F2F5-499F-9C07-0F2CAEE0D3EF}.Debug|x64.Build.0 = Debug|x64 - {0E4CC688-F2F5-499F-9C07-0F2CAEE0D3EF}.Release_2.7|Any CPU.ActiveCfg = Release|Win32 - {0E4CC688-F2F5-499F-9C07-0F2CAEE0D3EF}.Release_2.7|Mixed Platforms.ActiveCfg = Release|Win32 - {0E4CC688-F2F5-499F-9C07-0F2CAEE0D3EF}.Release_2.7|Mixed Platforms.Build.0 = Release|Win32 - {0E4CC688-F2F5-499F-9C07-0F2CAEE0D3EF}.Release_2.7|Mixed Platforms.Deploy.0 = Release|Win32 - {0E4CC688-F2F5-499F-9C07-0F2CAEE0D3EF}.Release_2.7|Win32.ActiveCfg = Release|Win32 - {0E4CC688-F2F5-499F-9C07-0F2CAEE0D3EF}.Release_2.7|Win32.Build.0 = Release|Win32 - {0E4CC688-F2F5-499F-9C07-0F2CAEE0D3EF}.Release_2.7|Win32.Deploy.0 = Release|Win32 - {0E4CC688-F2F5-499F-9C07-0F2CAEE0D3EF}.Release_2.7|x64.ActiveCfg = Release|x64 - {0E4CC688-F2F5-499F-9C07-0F2CAEE0D3EF}.Release_2.7|x64.Build.0 = Release|x64 - {0E4CC688-F2F5-499F-9C07-0F2CAEE0D3EF}.Release_2.7|x64.Deploy.0 = Release|x64 - {0E4CC688-F2F5-499F-9C07-0F2CAEE0D3EF}.Release|Any CPU.ActiveCfg = Release|Win32 - {0E4CC688-F2F5-499F-9C07-0F2CAEE0D3EF}.Release|Mixed Platforms.ActiveCfg = Release|Win32 - {0E4CC688-F2F5-499F-9C07-0F2CAEE0D3EF}.Release|Mixed Platforms.Build.0 = Release|Win32 - {0E4CC688-F2F5-499F-9C07-0F2CAEE0D3EF}.Release|Mixed Platforms.Deploy.0 = Release|Win32 - {0E4CC688-F2F5-499F-9C07-0F2CAEE0D3EF}.Release|Win32.ActiveCfg = Release|Win32 - {0E4CC688-F2F5-499F-9C07-0F2CAEE0D3EF}.Release|Win32.Build.0 = Release|Win32 - {0E4CC688-F2F5-499F-9C07-0F2CAEE0D3EF}.Release|Win32.Deploy.0 = Release|Win32 - {0E4CC688-F2F5-499F-9C07-0F2CAEE0D3EF}.Release|x64.ActiveCfg = Release|x64 - {0E4CC688-F2F5-499F-9C07-0F2CAEE0D3EF}.Release|x64.Build.0 = Release|x64 - {3E9C538F-F060-4E86-AB7D-D44439615B63}.Debug_2.7|Any CPU.ActiveCfg = Debug|Win32 - {3E9C538F-F060-4E86-AB7D-D44439615B63}.Debug_2.7|Mixed Platforms.ActiveCfg = Debug|Win32 - {3E9C538F-F060-4E86-AB7D-D44439615B63}.Debug_2.7|Mixed Platforms.Build.0 = Debug|Win32 - {3E9C538F-F060-4E86-AB7D-D44439615B63}.Debug_2.7|Mixed Platforms.Deploy.0 = Debug|Win32 - {3E9C538F-F060-4E86-AB7D-D44439615B63}.Debug_2.7|Win32.ActiveCfg = Debug|Win32 - {3E9C538F-F060-4E86-AB7D-D44439615B63}.Debug_2.7|Win32.Build.0 = Debug|Win32 - {3E9C538F-F060-4E86-AB7D-D44439615B63}.Debug_2.7|Win32.Deploy.0 = Debug|Win32 - {3E9C538F-F060-4E86-AB7D-D44439615B63}.Debug_2.7|x64.ActiveCfg = Debug|x64 - {3E9C538F-F060-4E86-AB7D-D44439615B63}.Debug_2.7|x64.Build.0 = Debug|x64 - {3E9C538F-F060-4E86-AB7D-D44439615B63}.Debug_2.7|x64.Deploy.0 = Debug|x64 - {3E9C538F-F060-4E86-AB7D-D44439615B63}.Debug|Any CPU.ActiveCfg = Debug|Win32 - {3E9C538F-F060-4E86-AB7D-D44439615B63}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 - {3E9C538F-F060-4E86-AB7D-D44439615B63}.Debug|Mixed Platforms.Build.0 = Debug|Win32 - {3E9C538F-F060-4E86-AB7D-D44439615B63}.Debug|Mixed Platforms.Deploy.0 = Debug|Win32 - {3E9C538F-F060-4E86-AB7D-D44439615B63}.Debug|Win32.ActiveCfg = Debug|Win32 - {3E9C538F-F060-4E86-AB7D-D44439615B63}.Debug|Win32.Build.0 = Debug|Win32 - {3E9C538F-F060-4E86-AB7D-D44439615B63}.Debug|Win32.Deploy.0 = Debug|Win32 - {3E9C538F-F060-4E86-AB7D-D44439615B63}.Debug|x64.ActiveCfg = Debug|x64 - {3E9C538F-F060-4E86-AB7D-D44439615B63}.Debug|x64.Build.0 = Debug|x64 - {3E9C538F-F060-4E86-AB7D-D44439615B63}.Release_2.7|Any CPU.ActiveCfg = Release|Win32 - {3E9C538F-F060-4E86-AB7D-D44439615B63}.Release_2.7|Mixed Platforms.ActiveCfg = Release|Win32 - {3E9C538F-F060-4E86-AB7D-D44439615B63}.Release_2.7|Mixed Platforms.Build.0 = Release|Win32 - {3E9C538F-F060-4E86-AB7D-D44439615B63}.Release_2.7|Mixed Platforms.Deploy.0 = Release|Win32 - {3E9C538F-F060-4E86-AB7D-D44439615B63}.Release_2.7|Win32.ActiveCfg = Release|Win32 - {3E9C538F-F060-4E86-AB7D-D44439615B63}.Release_2.7|Win32.Build.0 = Release|Win32 - {3E9C538F-F060-4E86-AB7D-D44439615B63}.Release_2.7|Win32.Deploy.0 = Release|Win32 - {3E9C538F-F060-4E86-AB7D-D44439615B63}.Release_2.7|x64.ActiveCfg = Release|x64 - {3E9C538F-F060-4E86-AB7D-D44439615B63}.Release_2.7|x64.Build.0 = Release|x64 - {3E9C538F-F060-4E86-AB7D-D44439615B63}.Release_2.7|x64.Deploy.0 = Release|x64 - {3E9C538F-F060-4E86-AB7D-D44439615B63}.Release|Any CPU.ActiveCfg = Release|Win32 - {3E9C538F-F060-4E86-AB7D-D44439615B63}.Release|Mixed Platforms.ActiveCfg = Release|Win32 - {3E9C538F-F060-4E86-AB7D-D44439615B63}.Release|Mixed Platforms.Build.0 = Release|Win32 - {3E9C538F-F060-4E86-AB7D-D44439615B63}.Release|Mixed Platforms.Deploy.0 = Release|Win32 - {3E9C538F-F060-4E86-AB7D-D44439615B63}.Release|Win32.ActiveCfg = Release|Win32 - {3E9C538F-F060-4E86-AB7D-D44439615B63}.Release|Win32.Build.0 = Release|Win32 - {3E9C538F-F060-4E86-AB7D-D44439615B63}.Release|Win32.Deploy.0 = Release|Win32 - {3E9C538F-F060-4E86-AB7D-D44439615B63}.Release|x64.ActiveCfg = Release|x64 - {3E9C538F-F060-4E86-AB7D-D44439615B63}.Release|x64.Build.0 = Release|x64 - {C4C45791-0201-4406-BC5C-A384B01E3BF5}.Debug_2.7|Any CPU.ActiveCfg = Debug_2.7|Win32 - {C4C45791-0201-4406-BC5C-A384B01E3BF5}.Debug_2.7|Mixed Platforms.ActiveCfg = Debug_2.7|Win32 - {C4C45791-0201-4406-BC5C-A384B01E3BF5}.Debug_2.7|Mixed Platforms.Build.0 = Debug_2.7|Win32 - {C4C45791-0201-4406-BC5C-A384B01E3BF5}.Debug_2.7|Mixed Platforms.Deploy.0 = Debug_2.7|Win32 - {C4C45791-0201-4406-BC5C-A384B01E3BF5}.Debug_2.7|Win32.ActiveCfg = Debug_2.7|Win32 - {C4C45791-0201-4406-BC5C-A384B01E3BF5}.Debug_2.7|Win32.Build.0 = Debug_2.7|Win32 - {C4C45791-0201-4406-BC5C-A384B01E3BF5}.Debug_2.7|Win32.Deploy.0 = Debug_2.7|Win32 - {C4C45791-0201-4406-BC5C-A384B01E3BF5}.Debug_2.7|x64.ActiveCfg = Debug_2.7|x64 - {C4C45791-0201-4406-BC5C-A384B01E3BF5}.Debug_2.7|x64.Build.0 = Debug_2.7|x64 - {C4C45791-0201-4406-BC5C-A384B01E3BF5}.Debug_2.7|x64.Deploy.0 = Debug_2.7|x64 - {C4C45791-0201-4406-BC5C-A384B01E3BF5}.Debug|Any CPU.ActiveCfg = Debug_2.7|Win32 - {C4C45791-0201-4406-BC5C-A384B01E3BF5}.Debug|Mixed Platforms.ActiveCfg = Debug_2.7|Win32 - {C4C45791-0201-4406-BC5C-A384B01E3BF5}.Debug|Mixed Platforms.Build.0 = Debug_2.7|Win32 - {C4C45791-0201-4406-BC5C-A384B01E3BF5}.Debug|Mixed Platforms.Deploy.0 = Debug_2.7|Win32 - {C4C45791-0201-4406-BC5C-A384B01E3BF5}.Debug|Win32.ActiveCfg = Debug_2.7|Win32 - {C4C45791-0201-4406-BC5C-A384B01E3BF5}.Debug|Win32.Build.0 = Debug_2.7|Win32 - {C4C45791-0201-4406-BC5C-A384B01E3BF5}.Debug|Win32.Deploy.0 = Debug_2.7|Win32 - {C4C45791-0201-4406-BC5C-A384B01E3BF5}.Debug|x64.ActiveCfg = Debug_2.7|x64 - {C4C45791-0201-4406-BC5C-A384B01E3BF5}.Debug|x64.Build.0 = Debug_2.7|x64 - {C4C45791-0201-4406-BC5C-A384B01E3BF5}.Release_2.7|Any CPU.ActiveCfg = Release_2.7|Win32 - {C4C45791-0201-4406-BC5C-A384B01E3BF5}.Release_2.7|Mixed Platforms.ActiveCfg = Release_2.7|Win32 - {C4C45791-0201-4406-BC5C-A384B01E3BF5}.Release_2.7|Mixed Platforms.Build.0 = Release_2.7|Win32 - {C4C45791-0201-4406-BC5C-A384B01E3BF5}.Release_2.7|Mixed Platforms.Deploy.0 = Release_2.7|Win32 - {C4C45791-0201-4406-BC5C-A384B01E3BF5}.Release_2.7|Win32.ActiveCfg = Release_2.7|Win32 - {C4C45791-0201-4406-BC5C-A384B01E3BF5}.Release_2.7|Win32.Build.0 = Release_2.7|Win32 - {C4C45791-0201-4406-BC5C-A384B01E3BF5}.Release_2.7|Win32.Deploy.0 = Release_2.7|Win32 - {C4C45791-0201-4406-BC5C-A384B01E3BF5}.Release_2.7|x64.ActiveCfg = Release_2.7|x64 - {C4C45791-0201-4406-BC5C-A384B01E3BF5}.Release_2.7|x64.Build.0 = Release_2.7|x64 - {C4C45791-0201-4406-BC5C-A384B01E3BF5}.Release_2.7|x64.Deploy.0 = Release_2.7|x64 - {C4C45791-0201-4406-BC5C-A384B01E3BF5}.Release|Any CPU.ActiveCfg = Release_2.7|Win32 - {C4C45791-0201-4406-BC5C-A384B01E3BF5}.Release|Mixed Platforms.ActiveCfg = Release_2.7|Win32 - {C4C45791-0201-4406-BC5C-A384B01E3BF5}.Release|Mixed Platforms.Build.0 = Release_2.7|Win32 - {C4C45791-0201-4406-BC5C-A384B01E3BF5}.Release|Mixed Platforms.Deploy.0 = Release_2.7|Win32 - {C4C45791-0201-4406-BC5C-A384B01E3BF5}.Release|Win32.ActiveCfg = Release_2.7|Win32 - {C4C45791-0201-4406-BC5C-A384B01E3BF5}.Release|Win32.Build.0 = Release_2.7|Win32 - {C4C45791-0201-4406-BC5C-A384B01E3BF5}.Release|Win32.Deploy.0 = Release_2.7|Win32 - {C4C45791-0201-4406-BC5C-A384B01E3BF5}.Release|x64.ActiveCfg = Release_2.7|x64 - {C4C45791-0201-4406-BC5C-A384B01E3BF5}.Release|x64.Build.0 = Release_2.7|x64 - {3F0BE77E-19B0-4192-B432-44A25805BCB8}.Debug_2.7|Any CPU.ActiveCfg = Debug|Any CPU - {3F0BE77E-19B0-4192-B432-44A25805BCB8}.Debug_2.7|Any CPU.Build.0 = Debug|Any CPU - {3F0BE77E-19B0-4192-B432-44A25805BCB8}.Debug_2.7|Mixed Platforms.ActiveCfg = Debug|Any CPU - {3F0BE77E-19B0-4192-B432-44A25805BCB8}.Debug_2.7|Mixed Platforms.Build.0 = Debug|Any CPU - {3F0BE77E-19B0-4192-B432-44A25805BCB8}.Debug_2.7|Win32.ActiveCfg = Debug|Any CPU - {3F0BE77E-19B0-4192-B432-44A25805BCB8}.Debug_2.7|Win32.Build.0 = Debug|Any CPU - {3F0BE77E-19B0-4192-B432-44A25805BCB8}.Debug_2.7|x64.ActiveCfg = Debug|Any CPU - {3F0BE77E-19B0-4192-B432-44A25805BCB8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {3F0BE77E-19B0-4192-B432-44A25805BCB8}.Debug|Any CPU.Build.0 = Debug|Any CPU - {3F0BE77E-19B0-4192-B432-44A25805BCB8}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {3F0BE77E-19B0-4192-B432-44A25805BCB8}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {3F0BE77E-19B0-4192-B432-44A25805BCB8}.Debug|Win32.ActiveCfg = Debug|Any CPU - {3F0BE77E-19B0-4192-B432-44A25805BCB8}.Debug|x64.ActiveCfg = Debug|Any CPU - {3F0BE77E-19B0-4192-B432-44A25805BCB8}.Release_2.7|Any CPU.ActiveCfg = Release|Any CPU - {3F0BE77E-19B0-4192-B432-44A25805BCB8}.Release_2.7|Any CPU.Build.0 = Release|Any CPU - {3F0BE77E-19B0-4192-B432-44A25805BCB8}.Release_2.7|Mixed Platforms.ActiveCfg = Release|Any CPU - {3F0BE77E-19B0-4192-B432-44A25805BCB8}.Release_2.7|Mixed Platforms.Build.0 = Release|Any CPU - {3F0BE77E-19B0-4192-B432-44A25805BCB8}.Release_2.7|Win32.ActiveCfg = Release|Any CPU - {3F0BE77E-19B0-4192-B432-44A25805BCB8}.Release_2.7|x64.ActiveCfg = Release|Any CPU - {3F0BE77E-19B0-4192-B432-44A25805BCB8}.Release|Any CPU.ActiveCfg = Release|Any CPU - {3F0BE77E-19B0-4192-B432-44A25805BCB8}.Release|Any CPU.Build.0 = Release|Any CPU - {3F0BE77E-19B0-4192-B432-44A25805BCB8}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {3F0BE77E-19B0-4192-B432-44A25805BCB8}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {3F0BE77E-19B0-4192-B432-44A25805BCB8}.Release|Win32.ActiveCfg = Release|Any CPU - {3F0BE77E-19B0-4192-B432-44A25805BCB8}.Release|x64.ActiveCfg = Release|Any CPU - {6471FEDC-3129-410F-BFFC-4BC89707E5EC}.Debug_2.7|Any CPU.ActiveCfg = Debug|Any CPU - {6471FEDC-3129-410F-BFFC-4BC89707E5EC}.Debug_2.7|Any CPU.Build.0 = Debug|Any CPU - {6471FEDC-3129-410F-BFFC-4BC89707E5EC}.Debug_2.7|Mixed Platforms.ActiveCfg = Debug|Any CPU - {6471FEDC-3129-410F-BFFC-4BC89707E5EC}.Debug_2.7|Mixed Platforms.Build.0 = Debug|Any CPU - {6471FEDC-3129-410F-BFFC-4BC89707E5EC}.Debug_2.7|Win32.ActiveCfg = Debug|Any CPU - {6471FEDC-3129-410F-BFFC-4BC89707E5EC}.Debug_2.7|x64.ActiveCfg = Debug|Any CPU - {6471FEDC-3129-410F-BFFC-4BC89707E5EC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {6471FEDC-3129-410F-BFFC-4BC89707E5EC}.Debug|Any CPU.Build.0 = Debug|Any CPU - {6471FEDC-3129-410F-BFFC-4BC89707E5EC}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {6471FEDC-3129-410F-BFFC-4BC89707E5EC}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {6471FEDC-3129-410F-BFFC-4BC89707E5EC}.Debug|Win32.ActiveCfg = Debug|Any CPU - {6471FEDC-3129-410F-BFFC-4BC89707E5EC}.Debug|x64.ActiveCfg = Debug|Any CPU - {6471FEDC-3129-410F-BFFC-4BC89707E5EC}.Release_2.7|Any CPU.ActiveCfg = Release|Any CPU - {6471FEDC-3129-410F-BFFC-4BC89707E5EC}.Release_2.7|Any CPU.Build.0 = Release|Any CPU - {6471FEDC-3129-410F-BFFC-4BC89707E5EC}.Release_2.7|Mixed Platforms.ActiveCfg = Release|Any CPU - {6471FEDC-3129-410F-BFFC-4BC89707E5EC}.Release_2.7|Mixed Platforms.Build.0 = Release|Any CPU - {6471FEDC-3129-410F-BFFC-4BC89707E5EC}.Release_2.7|Win32.ActiveCfg = Release|Any CPU - {6471FEDC-3129-410F-BFFC-4BC89707E5EC}.Release_2.7|x64.ActiveCfg = Release|Any CPU - {6471FEDC-3129-410F-BFFC-4BC89707E5EC}.Release|Any CPU.ActiveCfg = Release|Any CPU - {6471FEDC-3129-410F-BFFC-4BC89707E5EC}.Release|Any CPU.Build.0 = Release|Any CPU - {6471FEDC-3129-410F-BFFC-4BC89707E5EC}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {6471FEDC-3129-410F-BFFC-4BC89707E5EC}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {6471FEDC-3129-410F-BFFC-4BC89707E5EC}.Release|Win32.ActiveCfg = Release|Any CPU - {6471FEDC-3129-410F-BFFC-4BC89707E5EC}.Release|x64.ActiveCfg = Release|Any CPU - {D78837DC-BF31-4FC4-88A5-7F2FADAFA795}.Debug_2.7|Any CPU.ActiveCfg = Debug|Any CPU - {D78837DC-BF31-4FC4-88A5-7F2FADAFA795}.Debug_2.7|Any CPU.Build.0 = Debug|Any CPU - {D78837DC-BF31-4FC4-88A5-7F2FADAFA795}.Debug_2.7|Mixed Platforms.ActiveCfg = Debug|Any CPU - {D78837DC-BF31-4FC4-88A5-7F2FADAFA795}.Debug_2.7|Mixed Platforms.Build.0 = Debug|Any CPU - {D78837DC-BF31-4FC4-88A5-7F2FADAFA795}.Debug_2.7|Win32.ActiveCfg = Debug|Any CPU - {D78837DC-BF31-4FC4-88A5-7F2FADAFA795}.Debug_2.7|x64.ActiveCfg = Debug|Any CPU - {D78837DC-BF31-4FC4-88A5-7F2FADAFA795}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D78837DC-BF31-4FC4-88A5-7F2FADAFA795}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D78837DC-BF31-4FC4-88A5-7F2FADAFA795}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {D78837DC-BF31-4FC4-88A5-7F2FADAFA795}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {D78837DC-BF31-4FC4-88A5-7F2FADAFA795}.Debug|Win32.ActiveCfg = Debug|Any CPU - {D78837DC-BF31-4FC4-88A5-7F2FADAFA795}.Debug|x64.ActiveCfg = Debug|Any CPU - {D78837DC-BF31-4FC4-88A5-7F2FADAFA795}.Release_2.7|Any CPU.ActiveCfg = Release|Any CPU - {D78837DC-BF31-4FC4-88A5-7F2FADAFA795}.Release_2.7|Any CPU.Build.0 = Release|Any CPU - {D78837DC-BF31-4FC4-88A5-7F2FADAFA795}.Release_2.7|Mixed Platforms.ActiveCfg = Release|Any CPU - {D78837DC-BF31-4FC4-88A5-7F2FADAFA795}.Release_2.7|Mixed Platforms.Build.0 = Release|Any CPU - {D78837DC-BF31-4FC4-88A5-7F2FADAFA795}.Release_2.7|Win32.ActiveCfg = Release|Any CPU - {D78837DC-BF31-4FC4-88A5-7F2FADAFA795}.Release_2.7|x64.ActiveCfg = Release|Any CPU - {D78837DC-BF31-4FC4-88A5-7F2FADAFA795}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D78837DC-BF31-4FC4-88A5-7F2FADAFA795}.Release|Any CPU.Build.0 = Release|Any CPU - {D78837DC-BF31-4FC4-88A5-7F2FADAFA795}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {D78837DC-BF31-4FC4-88A5-7F2FADAFA795}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {D78837DC-BF31-4FC4-88A5-7F2FADAFA795}.Release|Win32.ActiveCfg = Release|Any CPU - {D78837DC-BF31-4FC4-88A5-7F2FADAFA795}.Release|x64.ActiveCfg = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(NestedProjects) = preSolution - {0E4CC688-F2F5-499F-9C07-0F2CAEE0D3EF} = {5A3C2DA6-AE91-4025-AC03-A58BD03CEBCD} - {3F0BE77E-19B0-4192-B432-44A25805BCB8} = {5A3C2DA6-AE91-4025-AC03-A58BD03CEBCD} - {EEFC9510-DFA7-439E-801E-48FCE72766AD} = {A7AF87D2-983B-4B3A-823F-5A2C6989672E} - {6471FEDC-3129-410F-BFFC-4BC89707E5EC} = {AAB21DD2-B0EE-493E-8415-5195F18879EB} - EndGlobalSection -EndGlobal diff --git a/pykd-0.3-2013.sln b/pykd.sln similarity index 100% rename from pykd-0.3-2013.sln rename to pykd.sln diff --git a/pykd_bootstrapper/dllmain.cpp b/pykd_bootstrapper/dllmain.cpp deleted file mode 100644 index 6284baf..0000000 --- a/pykd_bootstrapper/dllmain.cpp +++ /dev/null @@ -1,30 +0,0 @@ -// dllmain.cpp : Defines the entry point for the DLL application. -#include "stdafx.h" - - -static HMODULE pinHandle = NULL; - -BOOL APIENTRY DllMain( HMODULE hModule, - DWORD ul_reason_for_call, - LPVOID lpReserved - ) -{ - if (!pinHandle) - { - GetModuleHandleEx( - GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_PIN, - (LPCTSTR)hModule, - &pinHandle); - } - - switch (ul_reason_for_call) - { - case DLL_PROCESS_ATTACH: - case DLL_THREAD_ATTACH: - case DLL_THREAD_DETACH: - case DLL_PROCESS_DETACH: - break; - } - return TRUE; -} - diff --git a/pykd_bootstrapper/export.def b/pykd_bootstrapper/export.def deleted file mode 100644 index 63270bd..0000000 --- a/pykd_bootstrapper/export.def +++ /dev/null @@ -1,6 +0,0 @@ -EXPORTS - DebugExtensionInitialize - DebugExtensionUninitialize - py - install - upgrade diff --git a/pykd_bootstrapper/packages.pykd_bootstrapper_vc120.config b/pykd_bootstrapper/packages.pykd_bootstrapper_vc120.config deleted file mode 100644 index 26eab34..0000000 --- a/pykd_bootstrapper/packages.pykd_bootstrapper_vc120.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/pykd_bootstrapper/pykd_bootstrapper_vc120.vcxproj b/pykd_bootstrapper/pykd_bootstrapper_vc120.vcxproj deleted file mode 100644 index bb12135..0000000 --- a/pykd_bootstrapper/pykd_bootstrapper_vc120.vcxproj +++ /dev/null @@ -1,227 +0,0 @@ - - - - - Debug_2.7 - Win32 - - - Debug_2.7 - x64 - - - Release_2.7 - Win32 - - - Release_2.7 - x64 - - - - {CA0252CE-EF81-4DD8-A96F-A0E0E3644B7B} - Win32Proj - pykd_bootstrapper - pykd_ext - ..\ - true - - - - DynamicLibrary - true - v120_xp - Unicode - - - DynamicLibrary - true - v120_xp - Unicode - - - DynamicLibrary - false - v120_xp - true - Unicode - - - DynamicLibrary - false - v120_xp - true - Unicode - - - - - - - - - - - - - - - - - - 7f4aed3e - - - true - $(ProjectName) - $(SolutionDir)out\$(Platform)\$(Configuration)\ - - - true - $(ProjectName) - $(SolutionDir)out\$(Platform)\$(Configuration)\ - - - false - $(ProjectName) - $(SolutionDir)out\$(Platform)\$(Configuration)\ - - - false - $(ProjectName) - $(SolutionDir)out\$(Platform)\$(Configuration)\ - - - - Use - Level3 - Disabled - WIN32;_DEBUG;_WINDOWS;_USRDLL;PYKD_BOOTSTRAPPER_EXPORTS;%(PreprocessorDefinitions) - true - $(ProjectDir)..\kdlibcpp\include; - - - Windows - true - export.def - $(OutDir)pykd$(TargetExt) - comsuppw.lib;%(AdditionalDependencies) - - - - - Use - Level3 - Disabled - WIN32;_DEBUG;_WINDOWS;_USRDLL;PYKD_BOOTSTRAPPER_EXPORTS;%(PreprocessorDefinitions) - true - $(ProjectDir)..\kdlibcpp\include; - - - Windows - true - export.def - $(OutDir)pykd$(TargetExt) - comsuppw.lib;%(AdditionalDependencies) - - - - - Level3 - Use - MaxSpeed - true - true - WIN32;NDEBUG;_WINDOWS;_USRDLL;PYKD_BOOTSTRAPPER_EXPORTS;%(PreprocessorDefinitions) - true - $(ProjectDir)..\kdlibcpp\include; - MultiThreaded - - - Windows - true - true - true - export.def - $(OutDir)pykd$(TargetExt) - comsuppw.lib;%(AdditionalDependencies) - - - - - Level3 - Use - MaxSpeed - true - true - WIN32;NDEBUG;_WINDOWS;_USRDLL;PYKD_BOOTSTRAPPER_EXPORTS;%(PreprocessorDefinitions) - true - $(ProjectDir)..\kdlibcpp\include; - MultiThreaded - - - Windows - true - true - true - export.def - $(OutDir)pykd$(TargetExt) - comsuppw.lib;%(AdditionalDependencies) - - - - - - - - - - - - - - false - false - - - - - false - false - - - - - - - Create - Create - Create - Create - - - - - - - - - - - - - - - - - - - - This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - - - - \ No newline at end of file diff --git a/pykd_bootstrapper/pykd_bootstrapper_vc120.vcxproj.filters b/pykd_bootstrapper/pykd_bootstrapper_vc120.vcxproj.filters deleted file mode 100644 index d7e05bd..0000000 --- a/pykd_bootstrapper/pykd_bootstrapper_vc120.vcxproj.filters +++ /dev/null @@ -1,140 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;hm;inl;inc;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - - - - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - - - Source Files - - - - - - Resource Files - - - \ No newline at end of file diff --git a/pykd_bootstrapper/resource.h b/pykd_bootstrapper/resource.h deleted file mode 100644 index c3bc570..0000000 --- a/pykd_bootstrapper/resource.h +++ /dev/null @@ -1,14 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by version.rc - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 101 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1001 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif diff --git a/pykd_bootstrapper/stdafx.cpp b/pykd_bootstrapper/stdafx.cpp deleted file mode 100644 index 75c83a9..0000000 --- a/pykd_bootstrapper/stdafx.cpp +++ /dev/null @@ -1,8 +0,0 @@ -// stdafx.cpp : source file that includes just the standard includes -// pykd_bootstrapper.pch will be the pre-compiled header -// stdafx.obj will contain the pre-compiled type information - -#include "stdafx.h" - -// TODO: reference any additional headers you need in STDAFX.H -// and not in this file diff --git a/pykd_bootstrapper/stdafx.h b/pykd_bootstrapper/stdafx.h deleted file mode 100644 index a8b112f..0000000 --- a/pykd_bootstrapper/stdafx.h +++ /dev/null @@ -1,17 +0,0 @@ -// stdafx.h : include file for standard system include files, -// or project specific include files that are used frequently, but -// are changed infrequently -// - -#pragma once - -#include "targetver.h" - -#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers -// Windows Header Files: -#include - - -#define BOOST_PYTHON_STATIC_LIB - -// TODO: reference additional headers your program requires here diff --git a/pykd_bootstrapper/targetver.h b/pykd_bootstrapper/targetver.h deleted file mode 100644 index 90e767b..0000000 --- a/pykd_bootstrapper/targetver.h +++ /dev/null @@ -1,8 +0,0 @@ -#pragma once - -// Including SDKDDKVer.h defines the highest available Windows platform. - -// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and -// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. - -#include diff --git a/pykd_bootstrapper/version.h b/pykd_bootstrapper/version.h deleted file mode 100644 index 74182ca..0000000 --- a/pykd_bootstrapper/version.h +++ /dev/null @@ -1,15 +0,0 @@ -#pragma once - -#define PYKDEXT_VERSION_MAJOR 1 -#define PYKDEXT_VERSION_MINOR 0 -#define PYKDEXT_VERSION_SUBVERSION 1 -#define PYKDEXT_VERSION_BUILDNO 14 - -#define __VER_STR2__(x) #x -#define __VER_STR1__(x) __VER_STR2__(x) - -#define PYKDEXT_VERSION_BUILD_COMMA PYKDEXT_VERSION_MAJOR, PYKDEXT_VERSION_MINOR, PYKDEXT_VERSION_SUBVERSION, PYKDEXT_VERSION_BUILDNO -#define PYKDEXT_VERSION_BUILD PYKDEXT_VERSION_MAJOR.PYKDEXT_VERSION_MINOR.PYKDEXT_VERSION_SUBVERSION.PYKDEXT_VERSION_BUILDNO - -#define PYKDEXT_VERSION_BUILD_STR_COMMA __VER_STR1__(PYKDEXT_VERSION_BUILD_COMMA) -#define PYKDEXT_VERSION_BUILD_STR __VER_STR1__(PYKDEXT_VERSION_BUILD) diff --git a/pykd_bootstrapper/version.rc b/pykd_bootstrapper/version.rc deleted file mode 100644 index d21dc69..0000000 Binary files a/pykd_bootstrapper/version.rc and /dev/null differ diff --git a/pykd_bootstrapper/windbgext.cpp b/pykd_bootstrapper/windbgext.cpp deleted file mode 100644 index a5fb03e..0000000 --- a/pykd_bootstrapper/windbgext.cpp +++ /dev/null @@ -1,760 +0,0 @@ -#include "stdafx.h" - -#include - -#include -#include -#include - -#include -namespace python = boost::python; - -#include - -/////////////////////////////////////////////////////////////////////////////// - -class AutoRestorePyState -{ -public: - - AutoRestorePyState() - { - m_state = PyEval_SaveThread(); - } - - ~AutoRestorePyState() - { - PyEval_RestoreThread(m_state); - } - -private: - - PyThreadState* m_state; -}; - -////////////////////////////////////////////////////////////////////////////// - -class DbgOut -{ -public: - - DbgOut(PDEBUG_CLIENT client) - : m_control(client) - {} - - void write(const std::wstring& str) - { - AutoRestorePyState pystate; - - m_control->ControlledOutputWide( - DEBUG_OUTCTL_THIS_CLIENT, - DEBUG_OUTPUT_NORMAL, - L"%ws", - str.c_str() - ); - - } - - void writedml(const std::wstring& str) - { - AutoRestorePyState pystate; - - m_control->ControlledOutputWide( - DEBUG_OUTCTL_THIS_CLIENT | DEBUG_OUTCTL_DML, - DEBUG_OUTPUT_NORMAL, - L"%ws", - str.c_str() - ); - } - - void flush() { - } - - std::wstring encoding() { - return L"ascii"; - } - - bool closed() { - return false; - } - - bool isatty() { - return false; - } - -private: - - CComQIPtr m_control; -}; - -/////////////////////////////////////////////////////////////////////////////// - -class DbgIn -{ -public: - - DbgIn(PDEBUG_CLIENT client) - : m_control(client) - {} - - std::wstring readline() - { - AutoRestorePyState pystate; - - std::vector inputBuffer(0x10000); - - ULONG read = 0; - m_control->InputWide(&inputBuffer[0], static_cast(inputBuffer.size()), &read); - - std::wstring inputstr = std::wstring(&inputBuffer[0]); - - return inputstr.empty() ? L"\n" : inputstr; - } - - bool closed() { - return false; - } - - -private: - - CComQIPtr m_control; -}; - -/////////////////////////////////////////////////////////////////////////////// - -class PythonInterpreter -{ -public: - - PythonInterpreter() - { - PyThreadState* state = Py_NewInterpreter(); - - PyThreadState_Swap(state); - - m_state = PyEval_SaveThread(); - } - - ~PythonInterpreter() - { - PyEval_RestoreThread(m_state); - - PyInterpreterState *interpreter = m_state->interp; - - while (interpreter->tstate_head != NULL) - { - PyThreadState *threadState = (PyThreadState*)(interpreter->tstate_head); - - PyThreadState_Clear(threadState); - - PyThreadState_Swap(NULL); - - PyThreadState_Delete(threadState); - } - - PyInterpreterState_Clear(interpreter); - - PyInterpreterState_Delete(interpreter); - } - - void acivate() - { - PyEval_RestoreThread(m_state); - } - - void deactivate() - { - m_state = PyEval_SaveThread(); - } - -private: - - PyThreadState* m_state; - -}; - -/////////////////////////////////////////////////////////////////////////////// - -class PythonSingleton -{ - -public: - - static PythonSingleton* get() - { - if (!m_instance) - m_instance = new PythonSingleton(); - - return m_instance; - } - - void stop() - { - delete m_globalInterpreter; - m_globalInterpreter = 0; - PyThreadState_Swap(m_globalState); - - if (m_pykdInit) - { - python::object main = python::import("__main__"); - python::object globalScope(main.attr("__dict__")); - python::exec("__import__('pykd').deinitialize()", globalScope); - m_pykdInit = false; - } - - m_globalState = PyEval_SaveThread(); - } - - void start() - { - PyEval_RestoreThread(m_globalState); - - m_globalInterpreter = new PythonInterpreter(); - } - - void acivateGlobal() { - m_globalInterpreter->acivate(); - } - - void deactivateGlobal() { - m_globalInterpreter->deactivate(); - } - - void acivateLocal() { - PyEval_RestoreThread(m_globalState); - m_locallInterpreter = new PythonInterpreter(); - m_locallInterpreter->acivate(); - } - - void deactivateLocal() { - m_locallInterpreter->deactivate(); - delete m_locallInterpreter; - m_locallInterpreter = 0; - PyThreadState_Swap(m_globalState); - m_globalState = PyEval_SaveThread(); - } - - void checkPykd() - { - if (m_pykdInit) - return; - - python::handle<> pykdHandle(python::allow_null(PyImport_ImportModule("pykd"))); - if (!pykdHandle) - throw std::exception("Pykd package is not installed.You can install it by command \"!pykd.install\""); - - python::object main = python::import("__main__"); - python::object globalScope(main.attr("__dict__")); - python::exec("__import__('pykd').initialize()", globalScope); - - m_pykdInit = true; - } - -private: - - static PythonSingleton* m_instance; - - PythonSingleton() - { - Py_Initialize(); - PyEval_InitThreads(); - - // Python debug output console helper classes - python::class_("dout", "dout", python::no_init) - .def("write", &DbgOut::write) - .def("writedml", &DbgOut::writedml) - .def("flush", &DbgOut::flush) - .def("isatty", &DbgOut::isatty) - .add_property("encoding", &DbgOut::encoding) - .add_property("closed", &DbgOut::closed); - - python::class_("din", "din", python::no_init) - .def("readline", &DbgIn::readline) - .add_property("closed", &DbgIn::closed); - - - m_globalState = PyEval_SaveThread(); - } - - PythonInterpreter* m_globalInterpreter; - PythonInterpreter* m_locallInterpreter; - PyThreadState* m_globalState; - - bool m_pykdInit; -}; - -PythonSingleton* PythonSingleton::m_instance = 0; - -////////////////////////////////////////////////////////////////////////////// - -class InterruptWatch -{ -public: - - InterruptWatch(PDEBUG_CLIENT client) - { - m_control = client; - m_stopEvent = CreateEvent(NULL, TRUE, FALSE, NULL); - m_thread = CreateThread(NULL, 0, threadRoutine, this, 0, NULL); - } - - ~InterruptWatch() - { - SetEvent(m_stopEvent); - WaitForSingleObject(m_thread, INFINITE); - CloseHandle(m_stopEvent); - CloseHandle(m_thread); - } - - bool onInterrupt() - { - HANDLE quitEvent = CreateEvent(NULL, FALSE, FALSE, NULL); - PyGILState_STATE state = PyGILState_Ensure(); - Py_AddPendingCall(&quit, (void*)quitEvent); - PyGILState_Release(state); - WaitForSingleObject(quitEvent, INFINITE); - CloseHandle(quitEvent); - return true; - } - - static int quit(void *context) - { - HANDLE quitEvent = (HANDLE)context; - PyErr_SetString(PyExc_SystemExit, "CTRL+BREAK"); - SetEvent(quitEvent); - return -1; - } - -private: - - static DWORD WINAPI threadRoutine(LPVOID lpParameter) { - return static_cast(lpParameter)->interruptWatchRoutine(); - } - - DWORD InterruptWatch::interruptWatchRoutine() - { - while (WAIT_TIMEOUT == WaitForSingleObject(m_stopEvent, 250)) - { - HRESULT hres = m_control->GetInterrupt(); - if (hres == S_OK) - { - HANDLE quitEvent = CreateEvent(NULL, FALSE, FALSE, NULL); - PyGILState_STATE state = PyGILState_Ensure(); - Py_AddPendingCall(&quit, (void*)quitEvent); - PyGILState_Release(state); - WaitForSingleObject(quitEvent, INFINITE); - CloseHandle(quitEvent); - } - } - - return 0; - } - - HANDLE m_thread; - - HANDLE m_stopEvent; - - CComQIPtr m_control; -}; - -////////////////////////////////////////////////////////////////////////////// - -typedef std::vector< std::string > ArgsList; -typedef boost::escaped_list_separator char_separator_t; -typedef boost::tokenizer< char_separator_t > char_tokenizer_t; - -ArgsList getArgsList( - PCSTR args - ) -{ - std::string argsStr(args); - - char_tokenizer_t token(argsStr, char_separator_t("", " \t", "\"")); - ArgsList argsList; - - for (char_tokenizer_t::iterator it = token.begin(); it != token.end(); ++it) - { - if (*it != "") - argsList.push_back(*it); - } - - return argsList; -} - -////////////////////////////////////////////////////////////////////////////// - -static const char printUsageMsg[] = - "usage:\n" - "!py [options] [file]\n" - "\tOptions:\n" - "\t-g --global : run code in the common namespace\n" - "\t-l --local : run code in the isolate namespace\n" - "!install\n" - "!upgrade\n"; - -void printUsage(PDEBUG_CLIENT client) -{ - CComQIPtr(client)-> - ControlledOutput( - DEBUG_OUTCTL_THIS_CLIENT, - DEBUG_OUTPUT_NORMAL, - "%s", - printUsageMsg - ); -} - -////////////////////////////////////////////////////////////////////////////// - -extern "C" -HRESULT -CALLBACK -DebugExtensionInitialize( - PULONG Version, - PULONG Flags - ) -{ - PythonSingleton::get()->start(); - return S_OK; -} - -////////////////////////////////////////////////////////////////////////////// - -extern "C" -VOID -CALLBACK -DebugExtensionUninitialize() -{ - PythonSingleton::get()->stop(); -} - -////////////////////////////////////////////////////////////////////////////// - -std::string getScriptFileName(const std::string &scriptName); - -void printException(DbgOut &dbgOut); - -////////////////////////////////////////////////////////////////////////////// - -extern "C" -HRESULT -CALLBACK -py( - PDEBUG_CLIENT client, - PCSTR args - ) -{ - ArgsList argsList = getArgsList(args); - - bool global = false; - bool local = false; - bool clean = false; - - if (!argsList.empty()) - { - if (argsList[0] == "-h" || argsList[0] == "--help") - { - printUsage(client); - return S_OK; - } - else - if (argsList[0] == "-g" || argsList[0] == "--global") - { - global = true; - argsList.erase(argsList.begin()); - } - else - if (argsList[0] == "-l" || argsList[0] == "--local") - { - local = true; - argsList.erase(argsList.begin()); - } - } - - if (argsList.size() > 0) - { - global = !(global || local) ? false : global; //set local by default - } - else - { - global = !(global || local) ? true : global; //set global by default - } - - DbgOut dbgOut(client); - DbgOut dbgErr(client); - DbgIn dbgIn(client); - - ULONG oldMask; - client->GetOutputMask(&oldMask); - client->SetOutputMask(DEBUG_OUTPUT_NORMAL | DEBUG_OUTPUT_ERROR); - - - if (global) - PythonSingleton::get()->acivateGlobal(); - else - PythonSingleton::get()->acivateLocal(); - - try { - - InterruptWatch interruptWatch(client); - - python::object sys = python::import("sys"); - - sys.attr("stdout") = python::object(dbgOut); - sys.attr("stderr") = python::object(dbgErr); - sys.attr("stdin") = python::object(dbgIn); - - python::object main = python::import("__main__"); - python::object globalScope(main.attr("__dict__")); - - PythonSingleton::get()->checkPykd(); - - if (argsList.size() == 0) - { - - python::exec("import pykd", globalScope); - python::exec("from pykd import *", globalScope); - python::exec("__import__('code').InteractiveConsole(__import__('__main__').__dict__).interact()", globalScope); - } - else - { - - std::string scriptFileName = getScriptFileName(argsList[0]); - if (scriptFileName.empty()) - throw std::invalid_argument("script not found\n"); - - // óñòàíàâèëèâàåì ïèòîíîâñêèå àðãóìåíòû - char **pythonArgs = new char*[argsList.size()]; - - pythonArgs[0] = const_cast(scriptFileName.c_str()); - - for (size_t i = 1; i < argsList.size(); ++i) - pythonArgs[i] = const_cast(argsList[i].c_str()); - - PySys_SetArgv((int)argsList.size(), pythonArgs); - - delete[] pythonArgs; - - python::exec_file(scriptFileName.c_str(), globalScope); - } - } - catch (const python::error_already_set&) - { - printException(dbgOut); - } - catch (const std::exception& invalidArg) - { - _bstr_t bstrInavalidArg(invalidArg.what()); - dbgOut.write(std::wstring(bstrInavalidArg)); - } - - if (global) - PythonSingleton::get()->deactivateGlobal(); - else - PythonSingleton::get()->deactivateLocal(); - - client->SetOutputMask(oldMask); - - return S_OK; -} - -////////////////////////////////////////////////////////////////////////////// - -extern "C" -HRESULT -CALLBACK -install( - PDEBUG_CLIENT client, - PCSTR args - ) -{ - DbgOut dbgOut(client); - DbgOut dbgErr(client); - DbgIn dbgIn(client); - - PythonSingleton::get()->acivateGlobal(); - - try { - - python::object sys = python::import("sys"); - - sys.attr("stdout") = python::object(dbgOut); - sys.attr("stderr") = python::object(dbgErr); - sys.attr("stdin") = python::object(dbgIn); - - // ïîëó÷àåì äîñòóï ê ãëîáàëüíîìó ìàïó ( íóæåí äëÿ âûçîâà exec_file ) - python::object main = python::import("__main__"); - python::object global(main.attr("__dict__")); - - python::exec("import pip\n", global); - python::exec("pip.logger.consumers = []\n", global); - python::exec("pip.main(['install', 'pykd'])\n", global); - - } - catch (const python::error_already_set&) - { - printException(dbgOut); - } - catch (const std::exception& invalidArg) - { - _bstr_t bstrInavalidArg(invalidArg.what()); - dbgOut.write(std::wstring(bstrInavalidArg)); - } - - PythonSingleton::get()->deactivateGlobal(); - - return S_OK; -} - -////////////////////////////////////////////////////////////////////////////// - -extern "C" -HRESULT -CALLBACK -upgrade( - PDEBUG_CLIENT client, - PCSTR args - ) -{ - DbgOut dbgOut(client); - DbgOut dbgErr(client); - DbgIn dbgIn(client); - - PythonSingleton::get()->acivateGlobal(); - - try { - - python::object sys = python::import("sys"); - - sys.attr("stdout") = python::object(dbgOut); - sys.attr("stderr") = python::object(dbgErr); - sys.attr("stdin") = python::object(dbgIn); - - // ïîëó÷àåì äîñòóï ê ãëîáàëüíîìó ìàïó ( íóæåí äëÿ âûçîâà exec_file ) - python::object main = python::import("__main__"); - python::object global(main.attr("__dict__")); - - python::exec("import pip\n", global); - python::exec("pip.logger.consumers = []\n", global); - python::exec("pip.main(['install', '--upgrade', 'pykd'])\n", global); - - } - catch (const python::error_already_set&) - { - printException(dbgOut); - } - catch (const std::exception& invalidArg) - { - _bstr_t bstrInavalidArg(invalidArg.what()); - dbgOut.write(std::wstring(bstrInavalidArg)); - } - - PythonSingleton::get()->deactivateGlobal(); - - return S_OK; -} - -/////////////////////////////////////////////////////////////////////////////// - -std::string findScript(const std::string &fullFileName) -{ - if (GetFileAttributesA(fullFileName.c_str()) != INVALID_FILE_ATTRIBUTES) - return fullFileName; - - python::object sys = python::import("sys"); - - python::list pathList(sys.attr("path")); - - python::ssize_t n = python::len(pathList); - - for (python::ssize_t i = 0; i < n; i++) - { - std::string path = boost::python::extract(pathList[i]); - - DWORD bufSize = SearchPathA( - path.c_str(), - fullFileName.c_str(), - NULL, - 0, - NULL, - NULL); - - if (bufSize > 0) - { - bufSize += 1; - std::vector fullFileNameCStr(bufSize); - char *partFileNameCStr = NULL; - - bufSize = SearchPathA( - path.c_str(), - fullFileName.c_str(), - NULL, - bufSize, - &fullFileNameCStr[0], - &partFileNameCStr); - - DWORD fileAttr = GetFileAttributesA(&fullFileNameCStr[0]); - - if ((fileAttr & FILE_ATTRIBUTE_DIRECTORY) == 0) - return std::string(&fullFileNameCStr[0]); - } - } - - return ""; -} - -/////////////////////////////////////////////////////////////////////////////// - -std::string getScriptFileName(const std::string &scriptName) -{ - std::string scriptFileName = findScript(scriptName); - - if (scriptFileName.empty()) - { - std::string scriptNameLow; - scriptNameLow.resize(scriptName.size()); - std::transform( - scriptName.begin(), - scriptName.end(), - scriptNameLow.begin(), - ::tolower); - if (scriptNameLow.rfind(".py") != (scriptNameLow.length() - 3)) - scriptFileName = findScript(scriptName + ".py"); - } - - return scriptFileName; -} - -/////////////////////////////////////////////////////////////////////////////// - -void printException(DbgOut &dbgOut) -{ - // îøèáêà â ñêðèïòå - PyObject *errtype = NULL, *errvalue = NULL, *traceback = NULL; - - PyErr_Fetch(&errtype, &errvalue, &traceback); - - PyErr_NormalizeException(&errtype, &errvalue, &traceback); - - if (errtype != PyExc_SystemExit) - { - python::object tracebackModule = python::import("traceback"); - - std::wstringstream sstr; - - python::object lst = - python::object(tracebackModule.attr("format_exception"))( - python::handle<>(errtype), - python::handle<>(python::allow_null(errvalue)), - python::handle<>(python::allow_null(traceback))); - - sstr << std::endl << std::endl; - - for (long i = 0; i < python::len(lst); ++i) - sstr << std::wstring(python::extract(lst[i])) << std::endl; - - dbgOut.write(sstr.str()); - } -} - -/////////////////////////////////////////////////////////////////////////////// diff --git a/pykd_ext/arglist.cpp b/pykd_ext/arglist.cpp deleted file mode 100644 index ead8f4f..0000000 --- a/pykd_ext/arglist.cpp +++ /dev/null @@ -1,98 +0,0 @@ -#include "stdafx.h" - -#include -#include -#include - -#include "arglist.h" - - -namespace { - -typedef boost::escaped_list_separator char_separator_t; -typedef boost::tokenizer< char_separator_t > char_tokenizer_t; - -ArgsList getArgsList(const std::string& argsStr) -{ - char_tokenizer_t token(argsStr, char_separator_t("", " \t", "\"")); - ArgsList argsList; - - for (char_tokenizer_t::iterator it = token.begin(); it != token.end(); ++it) - { - if (*it != "") - argsList.push_back(*it); - } - - return argsList; -} - -} // anonymous namespace - - -static const std::regex versionRe("^-([2,3])(?:\\.(\\d+))?$"); - -Options::Options(const std::string& cmdline) : - pyMajorVersion(-1), - pyMinorVersion(-1), - global(false), - showHelp(false), - runModule(false) -{ - - args = getArgsList( cmdline ); - - if ( args.empty() ) - { - global = true; - } - - for (auto it = args.begin(); it != args.end();) - { - if (*it == "--global" || *it == "-g") - { - global = true; - it = args.erase(it); - continue; - } - - if (*it == "--local" || *it == "-l") - { - global = false; - it = args.erase(it); - continue; - } - - if (*it == "--help" || *it == "-h") - { - showHelp = true; - it = args.erase(it); - continue; - } - - if (*it == "--module" || *it == "-m") - { - runModule = true; - it = args.erase(it); - continue; - } - - std::smatch mres; - if (std::regex_match(*it, mres, versionRe)) - { - pyMajorVersion = atol(std::string(mres[1].first, mres[1].second).c_str()); - - if (mres[2].matched) - { - pyMinorVersion = atol(std::string(mres[2].first, mres[2].second).c_str()); - } - - it = args.erase(it); - continue; - } - - break; - } - -} - - diff --git a/pykd_ext/arglist.h b/pykd_ext/arglist.h deleted file mode 100644 index 63f6fb6..0000000 --- a/pykd_ext/arglist.h +++ /dev/null @@ -1,26 +0,0 @@ -#pragma once - -#include -#include - -typedef std::vector< std::string > ArgsList; - -struct Options -{ - int pyMajorVersion; - int pyMinorVersion; - bool global; - bool showHelp; - bool runModule; - std::vector args; - - Options() : - pyMajorVersion(-1), - pyMinorVersion(-1), - global(true), - showHelp(false), - runModule(false) - {} - - Options(const std::string& cmdline); -}; diff --git a/pykd_ext/dbgout.h b/pykd_ext/dbgout.h deleted file mode 100644 index 6dad55f..0000000 --- a/pykd_ext/dbgout.h +++ /dev/null @@ -1,122 +0,0 @@ -#pragma once - - -#include -#include -#include - -#include -#include - -#include "pycontext.h" -#include "pyclass.h" - -////////////////////////////////////////////////////////////////////////////// - -class DbgOut -{ -public: - - DbgOut(PDEBUG_CLIENT client) : - m_control(client) - {} - - void write(const std::wstring& str) - { - AutoRestorePyState pystate; - - m_control->ControlledOutputWide( - DEBUG_OUTCTL_AMBIENT_TEXT, //DEBUG_OUTCTL_THIS_CLIENT, - DEBUG_OUTPUT_NORMAL, - L"%ws", - str.c_str() - ); - - } - - void writedml(const std::wstring& str) - { - AutoRestorePyState pystate; - - m_control->ControlledOutputWide( - DEBUG_OUTCTL_AMBIENT_DML, //DEBUG_OUTCTL_THIS_CLIENT | DEBUG_OUTCTL_DML, - DEBUG_OUTPUT_NORMAL, - L"%ws", - str.c_str() - ); - } - - void flush() { - } - - std::wstring encoding() { - return L"ascii"; - } - - bool closed() { - return false; - } - - bool isatty() { - return false; - } - -public: - - BEGIN_PYTHON_METHOD_MAP(DbgOut, "dbgout") - PYTHON_METHOD1("write", write, "write"); - PYTHON_METHOD1("writedml", writedml, "writedml"); - PYTHON_METHOD0("flush", flush, "flush"); - PYTHON_PROPERTY("encoding", encoding, "encoding"); - PYTHON_PROPERTY("closed", closed, "closed"); - PYTHON_METHOD0("isatty", isatty, "isatty"); - END_PYTHON_METHOD_MAP - -private: - - CComQIPtr m_control; - -}; - -/////////////////////////////////////////////////////////////////////////////// - -class DbgIn -{ -public: - - DbgIn(PDEBUG_CLIENT client) : - m_control(client) - {} - - std::wstring readline() - { - AutoRestorePyState pystate; - - std::vector inputBuffer(0x10000); - - ULONG read = 0; - m_control->InputWide(&inputBuffer[0], static_cast(inputBuffer.size()), &read); - - std::wstring inputstr = std::wstring(&inputBuffer[0]); - - return inputstr.empty() ? L"\n" : inputstr; - } - - bool closed() { - return false; - } - -public: - - BEGIN_PYTHON_METHOD_MAP(DbgIn, "dbgin") - PYTHON_METHOD0("readline", readline, "readline"); - PYTHON_PROPERTY("closed", closed, "closed"); - END_PYTHON_METHOD_MAP - -private: - - CComQIPtr m_control; -}; - -////////////////////////////////////////////////////////////////////////////// - diff --git a/pykd_ext/dllmain.cpp b/pykd_ext/dllmain.cpp deleted file mode 100644 index 6284baf..0000000 --- a/pykd_ext/dllmain.cpp +++ /dev/null @@ -1,30 +0,0 @@ -// dllmain.cpp : Defines the entry point for the DLL application. -#include "stdafx.h" - - -static HMODULE pinHandle = NULL; - -BOOL APIENTRY DllMain( HMODULE hModule, - DWORD ul_reason_for_call, - LPVOID lpReserved - ) -{ - if (!pinHandle) - { - GetModuleHandleEx( - GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_PIN, - (LPCTSTR)hModule, - &pinHandle); - } - - switch (ul_reason_for_call) - { - case DLL_PROCESS_ATTACH: - case DLL_THREAD_ATTACH: - case DLL_THREAD_DETACH: - case DLL_PROCESS_DETACH: - break; - } - return TRUE; -} - diff --git a/pykd_ext/export.def b/pykd_ext/export.def deleted file mode 100644 index 3f4e5c2..0000000 --- a/pykd_ext/export.def +++ /dev/null @@ -1,8 +0,0 @@ -EXPORTS - DebugExtensionInitialize - DebugExtensionUninitialize - py - info - pip - help - select = selectVersion diff --git a/pykd_ext/packages.pykd_ext_vc120.config b/pykd_ext/packages.pykd_ext_vc120.config deleted file mode 100644 index 5122450..0000000 --- a/pykd_ext/packages.pykd_ext_vc120.config +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/pykd_ext/pyapi.h b/pykd_ext/pyapi.h deleted file mode 100644 index a852f5d..0000000 --- a/pykd_ext/pyapi.h +++ /dev/null @@ -1,213 +0,0 @@ -#pragma once - - -typedef void* PyObject; -typedef void* PyThreadState; -typedef PyObject *(*PyCFunction)(PyObject *, PyObject *); - - -typedef enum { PyGILState_LOCKED, PyGILState_UNLOCKED } PyGILState_STATE; - -const int Py_single_input = 256; -const int Py_file_input = 257; -const int Py_eval_input = 258; - -const int METH_VARARGS = 0x0001; - -struct PyMethodDef { - const char *ml_name; /* The name of the built-in function/method */ - PyCFunction ml_meth; /* The C function that implements it */ - int ml_flags; /* Combination of METH_xxx flags, which mostly - describe the args expected by the C func */ - const char *ml_doc; /* The __doc__ attribute, or NULL */ -}; - -typedef struct PyMethodDef PyMethodDef; - -void __stdcall Py_IncRef(PyObject* object); -void __stdcall Py_DecRef(PyObject* object); - -PyObject* __stdcall PyString_FromString(const char *v); -char* PyString_AsString(PyObject *string); -int PyString_Check(PyObject *o); - -PyObject* PyImport_Import(PyObject *name); -PyObject* __stdcall PyImport_ImportModule(const char *name); -PyObject* __stdcall PyImport_AddModule(const char *name); - -PyObject* __stdcall PyDict_New(); -int __stdcall PyDict_SetItemString(PyObject *p, const char *key, PyObject *val); - -PyObject* __stdcall PyTuple_New(size_t len); -PyObject* __stdcall PyTuple_GetItem(PyObject *p, size_t pos); -int __stdcall PyTuple_SetItem(PyObject *p, size_t pos, PyObject *obj); -PyObject* __stdcall PyDict_GetItemString(PyObject *p, const char *key); -void __stdcall PyDict_Clear(PyObject *p); -size_t __stdcall PyTuple_Size(PyObject *p); - -size_t PyList_Size(PyObject* list); -PyObject* PyList_GetItem(PyObject *list, size_t index); - -PyObject* __stdcall PyCFunction_NewEx(PyMethodDef *, PyObject *, PyObject *); -PyObject* __stdcall PyClass_New(PyObject* className, PyObject* classBases, PyObject* classDict); -PyObject* __stdcall PyMethod_New(PyObject *func, PyObject *self, PyObject *classobj); -PyObject* __stdcall PyInstance_New(PyObject *classobj, PyObject *arg, PyObject *kw); - -PyThreadState* __stdcall PyEval_SaveThread(); -void __stdcall PyEval_RestoreThread(PyThreadState *tstate); - -int __stdcall PySys_SetObject(char *name, PyObject *v); -PyObject* __stdcall PySys_GetObject(char *name); -void __stdcall PySys_SetArgv(int argc, char **argv); -void __stdcall PySys_SetArgv_Py3(int argc, wchar_t **argv); - -int __stdcall PyRun_SimpleString(const char* str); -PyObject* __stdcall PyRun_String(const char *str, int start, PyObject *globals, PyObject *locals); -PyObject* PyRun_File(FILE *fp, const char *filename, int start, PyObject *globals, PyObject *locals); - -typedef void(*PyCapsule_Destructor)(PyObject *); -PyObject* PyCapsule_New(void *pointer, const char *name, PyCapsule_Destructor destructor); -void* PyCapsule_GetPointer(PyObject *capsule, const char *name); - -int PyObject_SetAttrString(PyObject *o, const char *attr_name, PyObject *v); -PyObject* PyObject_GetAttrString(PyObject *o, const char *attr_name); -PyObject* PyObject_CallObject(PyObject *callable_object, PyObject *args); -PyObject* PyObject_Call(PyObject *callable_object, PyObject *args, PyObject *kw); - -PyObject* PyUnicode_FromWideChar(const wchar_t *w, size_t size); -int PyUnicode_Check(PyObject *o); - -PyObject* PyBool_FromLong(long v); - -PyObject* Py_None(); -PyObject* PyExc_SystemExit(); -PyObject* PyExc_TypeError(); -PyObject* PyType_Type(); -PyObject* PyProperty_Type(); - -void PyErr_Fetch(PyObject **ptype, PyObject **pvalue, PyObject **ptraceback); -void PyErr_NormalizeException(PyObject**exc, PyObject**val, PyObject**tb); -void PyErr_SetString(PyObject *type, const char *message); -void PyErr_Clear(); - -PyObject* PyFile_FromString(char *filename, char *mode); -FILE* PyFile_AsFile(PyObject *pyfile); -FILE* _Py_fopen(const char* filename, const char* mode); - -PyObject* __stdcall PyUnicode_FromString(const char* str); -PyObject* __stdcall PyInstanceMethod_New(PyObject *func); -size_t __stdcall PyUnicode_AsWideChar(PyObject *unicode, wchar_t *w, size_t size); -int __stdcall Py_AddPendingCall(int(*func)(void *), void *arg); - -PyGILState_STATE __stdcall PyGILState_Ensure(); -void __stdcall PyGILState_Release(PyGILState_STATE); - -PyObject* __stdcall PyDescr_NewMethod(PyObject* type, struct PyMethodDef *meth); - -size_t __stdcall PyGC_Collect(void); - -bool IsPy3(); - -class PyObjectRef; - - -class PyObjectBorrowedRef -{ - friend PyObjectRef; - -public: - - PyObjectBorrowedRef(PyObject* obj) - { - m_obj = obj; - if (m_obj) - Py_IncRef(m_obj); - } - - ~PyObjectBorrowedRef() - { - if (m_obj) - Py_DecRef(m_obj); - } - - operator PyObject*() - { - return m_obj; - } - -private: - - - PyObjectBorrowedRef(const PyObjectRef& obj) = delete; - - PyObject* m_obj; -}; - - -class PyObjectRef -{ -public: - - PyObjectRef() : m_obj(0) - {} - - PyObjectRef(PyObject* obj) - { - m_obj = obj; - } - - ~PyObjectRef() - { - if (m_obj) - Py_DecRef(m_obj); - } - - operator PyObject*() - { - return m_obj; - } - - PyObjectRef& operator= (const PyObjectRef& ref) - { - if (m_obj) - Py_DecRef(m_obj); - - m_obj = ref.m_obj; - if (m_obj) - Py_IncRef(m_obj); - - return *this; - } - - PyObjectRef& operator= (const PyObjectBorrowedRef& ref) - { - if (m_obj) - Py_DecRef(m_obj); - - m_obj = ref.m_obj; - if (m_obj) - Py_IncRef(m_obj); - - return *this; - } - - PyObjectRef& operator= (PyObject* obj) - { - if (m_obj) - Py_DecRef(m_obj); - - m_obj = obj; - - return *this; - } - -private: - - PyObjectRef(const PyObjectRef& obj) = delete; - - PyObject* m_obj; -}; - - - - diff --git a/pykd_ext/pyclass.h b/pykd_ext/pyclass.h deleted file mode 100644 index 68f209a..0000000 --- a/pykd_ext/pyclass.h +++ /dev/null @@ -1,232 +0,0 @@ -#pragma once - -#include "pyapi.h" - - -#include - -#include -#include - - -class convert_python_exception : public std::exception -{ -public: - convert_python_exception(const char* message) : std::exception(message) - {} -}; - - -struct convert_from_python -{ - convert_from_python(PyObject* obj) : m_obj(obj){} - - operator std::wstring() - { - if ( PyUnicode_Check(m_obj) ) - { - std::vector buf(0x10000); - size_t len = buf.size(); - len = PyUnicode_AsWideChar(m_obj, &buf[0], len); - return std::wstring(&buf[0], len); - } - - if ( !IsPy3() && PyString_Check(m_obj) ) - { - return std::wstring(_bstr_t(PyString_AsString(m_obj))); - } - - throw convert_python_exception("failed convert argument"); - } - - - operator std::string() - { - if (PyUnicode_Check(m_obj)) - { - std::vector buf(0x10000); - size_t len = buf.size(); - len = PyUnicode_AsWideChar(m_obj, &buf[0], len); - std::wstring str(&buf[0], len); - return std::string(_bstr_t(str.c_str())); - } - - if ( !IsPy3() && PyString_Check(m_obj) ) - { - return std::string(PyString_AsString(m_obj)); - } - - throw convert_python_exception("failed convert argument"); - } - - PyObject* m_obj; -}; - -struct convert_to_python -{ - operator PyObject* (){ - return m_obj; - } - - convert_to_python() - { - - } - - convert_to_python(const std::wstring& str) - { - m_obj = PyUnicode_FromWideChar(str.c_str(), str.size()); - } - - convert_to_python(bool v) - { - m_obj = PyBool_FromLong(v == true ? 1 : 0); - } - - PyObject* m_obj; -}; - - - -#define BEGIN_PYTHON_METHOD_MAP(classType, className) \ - template \ - PyObject* callMethod0( \ - TRet (classType::*method)()) \ - { \ - TRet r = (this->*method)(); \ - return convert_to_python(r); \ - } \ - PyObject* callMethod0(\ - void (classType::*method)()) \ - { \ - (this->*method)(); \ - Py_IncRef(Py_None()); \ - return Py_None(); \ - } \ - template \ - PyObject* callMethod1( \ - TRet (classType::*method)(V1& v1), \ - convert_from_python& v1)\ - { \ - return (this->*method)(v1); \ - } \ - template \ - PyObject* callMethod1(\ - void(classType::*method)(V1& v1), \ - convert_from_python& v1)\ - { \ - (this->*method)(v1); \ - Py_IncRef(Py_None()); \ - return Py_None(); \ - } \ -template \ -static PyObject* getPythonClass() { \ - PyObject* args = PyTuple_New(3); \ - PyTuple_SetItem(args, 0, IsPy3() ? PyUnicode_FromString(className) : PyString_FromString(className)); \ - PyTuple_SetItem(args, 1, PyTuple_New(0)); \ - PyTuple_SetItem(args, 2, PyDict_New()); \ - PyObject* classTypeObj = PyObject_CallObject(PyType_Type(), args); \ - Py_DecRef(args); - -#define END_PYTHON_METHOD_MAP \ - return classTypeObj; \ - } - -#define PYTHON_METHOD0(name, fn, doc) \ - struct Call_##fn { \ - static PyObject* pycall(PyObject *s, PyObject *args) \ - { \ - try { \ - PyObject* self = PyTuple_GetItem(args, 0); \ - PyObject* cppobj = PyObject_GetAttrString(self, "cppobject"); \ - T* _this = reinterpret_cast(PyCapsule_GetPointer(cppobj, "cppobject")); \ - Py_DecRef(cppobj); \ - return _this->callMethod0(&fn); \ - } \ - catch(convert_python_exception& exc) \ - { PyErr_SetString(PyExc_TypeError(), exc.what()); } \ - return Py_None(); \ - } \ - }; \ - {\ - static PyMethodDef methodDef = { name, Call_##fn::pycall, METH_VARARGS }; \ - PyObject* cFuncObj = PyCFunction_NewEx(&methodDef, NULL, NULL); \ - PyObject* methodObj = IsPy3() ? PyInstanceMethod_New(cFuncObj) : PyMethod_New(cFuncObj, NULL, classTypeObj); \ - PyObject_SetAttrString(classTypeObj, name, methodObj); \ - Py_DecRef(cFuncObj), Py_DecRef(methodObj); \ - } - -#define PYTHON_METHOD1(name, fn, doc) \ - struct Call_##fn { \ - static PyObject* pycall(PyObject *s, PyObject *args) \ - { \ - PyObject* self = PyTuple_GetItem(args, 0); \ - PyObject* cppobj = PyObject_GetAttrString(self, "cppobject"); \ - T* _this = reinterpret_cast(PyCapsule_GetPointer(cppobj, "cppobject")); \ - Py_DecRef(cppobj); \ - PyObject* v1 = PyTuple_GetItem(args, 1); \ - return _this->callMethod1(&fn, convert_from_python(v1)); \ - } \ - }; \ - {\ - static PyMethodDef methodDef = { name, Call_##fn::pycall, METH_VARARGS }; \ - PyObject* cFuncObj = PyCFunction_NewEx(&methodDef, NULL, NULL); \ - PyObject* methodObj = IsPy3() ? PyInstanceMethod_New(cFuncObj) : PyMethod_New(cFuncObj, NULL, classTypeObj); \ - PyObject_SetAttrString(classTypeObj, name, methodObj); \ - Py_DecRef(cFuncObj), Py_DecRef(methodObj); \ - } - -#define PYTHON_PROPERTY(name, fn, doc) \ - struct Call_##fn{ \ - static PyObject* pycall(PyObject *s, PyObject *args) \ - { \ - PyObject* self = PyTuple_GetItem(args, 0); \ - PyObject* cppobj = PyObject_GetAttrString(self, "cppobject"); \ - T* _this = reinterpret_cast(PyCapsule_GetPointer(cppobj, "cppobject")); \ - Py_DecRef(cppobj); \ - return _this->callMethod0(&fn); \ - } \ - }; \ - {\ - static PyMethodDef methodDef = { name, Call_##fn::pycall, METH_VARARGS }; \ - PyObject* cFuncObj = PyCFunction_NewEx(&methodDef, NULL, NULL); \ - PyObject* methodObj = IsPy3() ? PyInstanceMethod_New(cFuncObj) : PyMethod_New(cFuncObj, NULL, classTypeObj); \ - PyObject* args = PyTuple_New(4); \ - Py_IncRef(PyProperty_Type()); \ - PyTuple_SetItem(args, 0, methodObj); \ - PyTuple_SetItem(args, 1, Py_None()); \ - PyTuple_SetItem(args, 2, Py_None()); \ - PyTuple_SetItem(args, 3, IsPy3() ? PyUnicode_FromString(doc) : PyString_FromString(doc));\ - PyObject* propertyObj = PyObject_CallObject(PyProperty_Type(), args); \ - PyObject_SetAttrString(classTypeObj, name, propertyObj); \ - Py_DecRef(cFuncObj), Py_DecRef(propertyObj), Py_DecRef(args); \ - } - - - -template -void delete_pyobject(PyObject* obj) -{ - T1* cppobj = reinterpret_cast(PyCapsule_GetPointer(obj, "cppobject")); - delete cppobj; -} - -template -PyObject* make_pyobject(const T2& var) -{ - PyObject* cls = T1::getPythonClass(); - PyObject* p1 = PyObject_CallObject(cls, NULL); - Py_DecRef(cls); - - T1* t1 = new T1(var); - PyObject* p2 = PyCapsule_New(t1, "cppobject", delete_pyobject); - - PyObject_SetAttrString(p1, "cppobject", p2); - - Py_DecRef(p2); - - return p1; -} - - - diff --git a/pykd_ext/pycontext.h b/pykd_ext/pycontext.h deleted file mode 100644 index 5d06fd2..0000000 --- a/pykd_ext/pycontext.h +++ /dev/null @@ -1,23 +0,0 @@ -#pragma once - -#include "pyapi.h" - -class AutoRestorePyState -{ -public: - - AutoRestorePyState() - { - m_state = PyEval_SaveThread(); - } - - ~AutoRestorePyState() - { - PyEval_RestoreThread(m_state); - } - -private: - - PyThreadState* m_state; -}; - diff --git a/pykd_ext/pyinterpret.cpp b/pykd_ext/pyinterpret.cpp deleted file mode 100644 index b4a3e7e..0000000 --- a/pykd_ext/pyinterpret.cpp +++ /dev/null @@ -1,917 +0,0 @@ -#include "stdafx.h" -#include "pyinterpret.h" - -#include -#include -#include -#include -#include - -#include "pymodule.h" -#include "pyclass.h" -#include "dbgout.h" - -class PyModule; -class PythonInterpreter; - -class HKey -{ - -public: - - HKey() : m_key(NULL) - {} - - ~HKey() - { - if (m_key) - RegCloseKey(m_key); - } - - operator HKEY*() - { - return &m_key; - } - - operator HKEY() const - { - return m_key; - } - -private: - - HKEY m_key; -}; - - -class PyModule -{ -public: - - PyModule(int majorVesion, int minorVersion); - - ~PyModule(); - - bool isPy3; - - void checkPykd(); - void deactivate(); - - PyObject* PyType_Type; - PyObject* PyProperty_Type; - PyObject* Py_None; - PyObject* PyExc_SystemExit; - PyObject* PyExc_TypeError; - PyObject* PyUnicode_Type; - PyObject* PyString_Type; - - PyThreadState* PyThreadState_Current; - - void( *Py_Initialize)(); - void( *Py_Finalize)(); - - PyThreadState* ( *Py_NewInterpreter)(); - void( *Py_EndInterpreter)(PyThreadState *tstate); - PyObject* ( *PyEval_GetGlobals)(); - PyObject* ( *PyImport_Import)(PyObject *name); - PyObject* ( *PyImport_ImportModule)(const char *name); - void( *PyEval_InitThreads)(); - PyThreadState* ( *PyEval_SaveThread)(); - void( *PyEval_RestoreThread)(PyThreadState *tstate); - PyThreadState* ( *PyThreadState_Swap)(PyThreadState *tstate); - PyObject* ( *PyRun_String)(const char *str, int start, PyObject *globals, PyObject *locals); - int( *PyRun_SimpleString)(const char* str); - PyObject* ( *PyRun_File)(FILE *fp, const char *filename, int start, PyObject *globals, PyObject *locals); - PyObject* ( *PyDict_New)(); - int( *PyDict_SetItemString)(PyObject *p, const char *key, PyObject *val); - PyObject*( *PyDict_GetItemString)(PyObject *p, const char* key); - void ( *PyDict_Clear)(PyObject *p); - void( *Py_IncRef)(PyObject* object); - void( *Py_DecRef)(PyObject* object); - PyObject* ( *PyObject_Call)(PyObject *callable_object, PyObject *args, PyObject *kw); - PyObject* ( *PyObject_GetAttr)(PyObject *object, PyObject *attr_name); - PyObject* ( *PyObject_GetAttrString)(PyObject *object, const char *attr_name); - int( *PyObject_SetAttr)(PyObject *object, PyObject *attr_name, PyObject *value); - PyObject* ( *PyObject_CallObject)(PyObject *callable_object, PyObject *args); - PyObject* ( *PyTuple_New)(size_t len); - int( *PyTuple_SetItem)(PyObject *p, size_t pos, PyObject *o); - PyObject* ( *PyTuple_GetItem)(PyObject *p, size_t pos); - size_t( *PyTuple_Size)(PyObject *p); - PyObject* ( *PyCFunction_NewEx)(PyMethodDef *, PyObject *, PyObject *); - PyObject* ( *PySys_GetObject)(char *name); - int( *PySys_SetObject)(char *name, PyObject *v); - void( *PySys_SetArgv)(int argc, char **argv); - void( *PySys_SetArgv_Py3)(int argc, wchar_t **argv); - PyObject* ( *PyString_FromString)(const char *v); - char* ( *PyString_AsString)(PyObject *string); - void( *PyErr_Fetch)(PyObject **ptype, PyObject **pvalue, PyObject **ptraceback); - void( *PyErr_NormalizeException)(PyObject**exc, PyObject**val, PyObject**tb); - void( *PyErr_SetString)(PyObject *type, const char *message); - void( *PyErr_Clear)(); - PyObject* ( *PyImport_AddModule)(const char *name); - PyObject* ( *PyClass_New)(PyObject* className, PyObject* classBases, PyObject* classDict); - PyObject* ( *PyInstance_New)(PyObject *classobj, PyObject *arg, PyObject *kw); - PyObject* ( *PyMethod_New)(PyObject *func, PyObject *self, PyObject *classobj); - PyObject* ( *PyCapsule_New)(void *pointer, const char *name, PyCapsule_Destructor destructor); - void* ( *PyCapsule_GetPointer)(PyObject *capsule, const char *name); - int ( *PyObject_SetAttrString)(PyObject *o, const char *attr_name, PyObject *v); - int ( *PyObject_IsInstance)(PyObject *inst, PyObject *cls); - PyObject* ( *PyUnicode_FromWideChar)(const wchar_t *w, size_t size); - PyObject* ( *PyBool_FromLong)(long v); - size_t( *PyList_Size)(PyObject* list); - PyObject* ( *PyList_GetItem)(PyObject *list, size_t index); - PyObject* ( *PyFile_FromString)(char *filename, char *mode); - FILE* ( *PyFile_AsFile)(PyObject *pyfile); - PyObject* ( *PyUnicode_FromString)(const char *u); - PyObject* ( *PyInstanceMethod_New)(PyObject *func); - size_t( *PyUnicode_AsWideChar)(PyObject *unicode, wchar_t *w, size_t size); - FILE* ( *_Py_fopen)(const char* filename, const char* mode); - int( *Py_AddPendingCall)(int(*func)(void *), void *arg); - PyGILState_STATE( *PyGILState_Ensure)(); - void( *PyGILState_Release)(PyGILState_STATE state); - PyObject* ( *PyDescr_NewMethod)(PyObject* type, struct PyMethodDef *meth); - size_t (*PyGC_Collect)(void); - void(*PyImport_Cleanup)(void); - - HMODULE m_handlePython; - PyThreadState* m_globalState; - PythonInterpreter* m_globalInterpreter; - bool m_pykdInit; -}; - - - -class PythonInterpreter -{ -public: - - PythonInterpreter(PyModule* mod) : - m_module(mod) - { - m_state = mod->Py_NewInterpreter(); - } - - ~PythonInterpreter() - { - m_module->PyEval_RestoreThread(m_state); - - m_module->PyImport_Cleanup(); - - m_module->Py_EndInterpreter(m_state); - } - - PyModule* m_module; - - PyThreadState* m_state; -}; - - -class PythonSingleton -{ -public: - - - static PythonSingleton* get() - { - if (m_singleton.get() == 0) - m_singleton.reset(new PythonSingleton()); - return m_singleton.get(); - } - - - PythonInterpreter* currentInterpreter() - { - if ( m_currentInterpreter ) - return m_currentInterpreter; - - for ( auto mod : m_modules) - { - if ( mod.second->PyThreadState_Current != 0 ) - { - return mod.second->m_globalInterpreter; - } - } - - return NULL; - } - - PythonInterpreter* getInterpreter(int majorVersion, int minorVersion, bool global) - { - PyModule* module = 0; - - if (m_modules.find(std::make_pair(majorVersion, minorVersion)) == m_modules.end()) - { - module = new PyModule(majorVersion, minorVersion); - m_modules.insert(std::make_pair(std::make_pair(majorVersion, minorVersion), module)); - } - else - { - module = m_modules[std::make_pair(majorVersion, minorVersion)]; - } - - module->PyEval_RestoreThread(module->m_globalState); - module->checkPykd(); - - if (global) - { - if (module->m_globalInterpreter == 0) - { - module->m_globalInterpreter = new PythonInterpreter(module); - } - - m_currentInterpreter = module->m_globalInterpreter; - m_currentIsGlobal = true; - } - else - { - m_currentInterpreter = new PythonInterpreter(module); - m_currentIsGlobal = false; - } - - module->PyThreadState_Swap(m_currentInterpreter->m_state); - - return m_currentInterpreter; - } - - void releaseInterpretor(PythonInterpreter* interpret) - { - PyModule* module = m_currentInterpreter->m_module; - - m_currentInterpreter->m_state = module->PyEval_SaveThread(); - - if (!m_currentIsGlobal) - { - delete m_currentInterpreter; - module->PyThreadState_Swap(module->m_globalState); - module->m_globalState = module->PyEval_SaveThread(); - } - - m_currentInterpreter = 0; - } - - bool isInterpreterLoaded(int majorVersion, int minorVersion) - { - return m_modules.find(std::make_pair(majorVersion, minorVersion)) != m_modules.end(); - } - - void stopAllInterpreter() - { - for (auto m : m_modules) - { - m_currentInterpreter = m.second->m_globalInterpreter; - m.second->deactivate(); - } - m_currentInterpreter = 0; - } - -private: - - static std::auto_ptr m_singleton; - - std::map, PyModule*> m_modules; - - PythonInterpreter* m_currentInterpreter; - bool m_currentIsGlobal; -}; - -std::auto_ptr PythonSingleton::m_singleton; - -HMODULE LoadPythonForKey(HKEY installPathKey, int majorVersion, int minorVersion) -{ - - HMODULE hmodule = NULL; - - char installPath[1000]; - DWORD installPathSize = sizeof(installPath); - - if (ERROR_SUCCESS == RegQueryValueExA(installPathKey, NULL, NULL, NULL, (LPBYTE)installPath, &installPathSize)) - { - std::stringstream dllName; - dllName << "python" << majorVersion << minorVersion << ".dll"; - - std::stringstream imagePath; - imagePath << installPath << dllName.str(); - - hmodule = LoadLibraryExA(imagePath.str().c_str(), NULL, LOAD_WITH_ALTERED_SEARCH_PATH); - if (hmodule) - return hmodule; - - hmodule = LoadLibraryA(dllName.str().c_str()); - if (hmodule) - return hmodule; - - } - - return NULL; -} - - -HMODULE LoadPythonLibrary(int majorVersion, int minorVersion) -{ - - HKey pythonCoreKey; - - for (auto rootKey : std::list({ HKEY_LOCAL_MACHINE, HKEY_CURRENT_USER })) - { - if (ERROR_SUCCESS == RegOpenKeyA(rootKey, "SOFTWARE\\Python\\PythonCore", pythonCoreKey)) - { - HKey installPathKey; - - std::stringstream installPathStr; - - if (majorVersion == 2 || (majorVersion == 3 && minorVersion <= 4)) - { - installPathStr << majorVersion << '.' << minorVersion << "\\InstallPath"; - } - else - if (majorVersion == 3 && minorVersion >= 5) - { -#ifdef _M_X64 - installPathStr << majorVersion << '.' << minorVersion << "\\InstallPath"; -#else - installPathStr << majorVersion << '.' << minorVersion << "-32" << "\\InstallPath"; -#endif - } - - if (ERROR_SUCCESS == RegOpenKeyA(pythonCoreKey, installPathStr.str().c_str(), installPathKey)) - { - HMODULE hmodule = LoadPythonForKey(installPathKey, majorVersion, minorVersion); - if (hmodule) - return hmodule; - } - } - } - - return NULL; -} - - -std::list getInstalledInterpreter() -{ - std::set interpretSet; - - for (auto rootKey : const std::list({ HKEY_LOCAL_MACHINE, HKEY_CURRENT_USER })) - { - HKey pythonCoreKey; - - if (ERROR_SUCCESS != RegOpenKeyA(rootKey, "SOFTWARE\\Python\\PythonCore", pythonCoreKey)) - continue; - - for (DWORD i = 0;; ++i) - { - char versionStr[20]; - if (ERROR_SUCCESS != RegEnumKeyA(pythonCoreKey, i, versionStr, sizeof(versionStr))) - break; - - int majorVersion = -1, minorVersion = -1; - sscanf_s(versionStr, "%d.%d", &majorVersion, &minorVersion); - - HKey installPathKey; - std::string installPathStr(versionStr); - installPathStr += "\\InstallPath"; - - if (ERROR_SUCCESS != RegOpenKeyA(pythonCoreKey, installPathStr.c_str(), installPathKey)) - continue; - - HMODULE hmodule = LoadPythonForKey(installPathKey, majorVersion, minorVersion); - - if (hmodule) - { - char fullPath[1000]; - - if (GetModuleFileNameA(hmodule, fullPath, sizeof(fullPath))) - { - interpretSet.insert({ majorVersion, minorVersion, fullPath }); - } - - FreeLibrary(hmodule); - } - } - } - - std::list interpretLst; - - std::copy(interpretSet.begin(), interpretSet.end(), std::inserter(interpretLst, interpretLst.begin())); - - interpretLst.sort(); - - return interpretLst; -} - -PyModule::PyModule(int majorVesion, int minorVersion) -{ - m_handlePython = LoadPythonLibrary(majorVesion, minorVersion); - - if (!m_handlePython) - throw std::exception("failed to load python module"); - - isPy3 = majorVesion == 3; - - *reinterpret_cast(&PyType_Type) = GetProcAddress(m_handlePython, "PyType_Type"); - *reinterpret_cast(&PyProperty_Type) = GetProcAddress(m_handlePython, "PyProperty_Type"); - *reinterpret_cast(&PyUnicode_Type) = GetProcAddress(m_handlePython, "PyUnicode_Type"); - *reinterpret_cast(&PyString_Type) = GetProcAddress(m_handlePython, "PyString_Type"); - *reinterpret_cast(&Py_None) = GetProcAddress(m_handlePython, "_Py_NoneStruct"); - PyExc_SystemExit = *reinterpret_cast(GetProcAddress(m_handlePython, "PyExc_SystemExit")); - PyExc_TypeError= *reinterpret_cast(GetProcAddress(m_handlePython, "PyExc_TypeError")); - PyThreadState_Current = reinterpret_cast(GetProcAddress(m_handlePython, "_PyThreadState_Current")); - *reinterpret_cast(&Py_Initialize) = GetProcAddress(m_handlePython, "Py_Initialize"); - *reinterpret_cast(&Py_Finalize) = GetProcAddress(m_handlePython, "Py_Finalize"); - *reinterpret_cast(&Py_NewInterpreter) = GetProcAddress(m_handlePython, "Py_NewInterpreter"); - *reinterpret_cast(&Py_EndInterpreter) = GetProcAddress(m_handlePython, "Py_EndInterpreter"); - *reinterpret_cast(&Py_DecRef) = GetProcAddress(m_handlePython, "Py_DecRef"); - *reinterpret_cast(&Py_IncRef) = GetProcAddress(m_handlePython, "Py_IncRef"); - *reinterpret_cast(&PyEval_GetGlobals) = GetProcAddress(m_handlePython, "PyEval_GetGlobals"); - *reinterpret_cast(&PyEval_InitThreads) = GetProcAddress(m_handlePython, "PyEval_InitThreads"); - *reinterpret_cast(&PyEval_SaveThread) = GetProcAddress(m_handlePython, "PyEval_SaveThread"); - *reinterpret_cast(&PyEval_RestoreThread) = GetProcAddress(m_handlePython, "PyEval_RestoreThread"); - *reinterpret_cast(&PyThreadState_Swap) = GetProcAddress(m_handlePython, "PyThreadState_Swap"); - *reinterpret_cast(&PyRun_String) = GetProcAddress(m_handlePython, "PyRun_String"); - *reinterpret_cast(&PyRun_SimpleString) = GetProcAddress(m_handlePython, "PyRun_SimpleString"); - *reinterpret_cast(&PyRun_File) = GetProcAddress(m_handlePython, "PyRun_File"); - *reinterpret_cast(&PyDict_New) = GetProcAddress(m_handlePython, "PyDict_New"); - *reinterpret_cast(&PyDict_SetItemString) = GetProcAddress(m_handlePython, "PyDict_SetItemString"); - *reinterpret_cast(&PyDict_GetItemString) = GetProcAddress(m_handlePython, "PyDict_GetItemString"); - *reinterpret_cast(&PyDict_Clear) = GetProcAddress(m_handlePython, "PyDict_Clear"); - *reinterpret_cast(&PyObject_Call) = GetProcAddress(m_handlePython, "PyObject_Call"); - *reinterpret_cast(&PyObject_GetAttr) = GetProcAddress(m_handlePython, "PyObject_GetAttr"); - *reinterpret_cast(&PyObject_GetAttrString) = GetProcAddress(m_handlePython, "PyObject_GetAttrString"); - *reinterpret_cast(&PyObject_SetAttr) = GetProcAddress(m_handlePython, "PyObject_SetAttr"); - *reinterpret_cast(&PyObject_CallObject) = GetProcAddress(m_handlePython, "PyObject_CallObject"); - *reinterpret_cast(&PyObject_IsInstance) = GetProcAddress(m_handlePython, "PyObject_IsInstance"); - *reinterpret_cast(&PyTuple_New) = GetProcAddress(m_handlePython, "PyTuple_New"); - *reinterpret_cast(&PyTuple_SetItem) = GetProcAddress(m_handlePython, "PyTuple_SetItem"); - *reinterpret_cast(&PyTuple_GetItem) = GetProcAddress(m_handlePython, "PyTuple_GetItem"); - *reinterpret_cast(&PyTuple_Size) = GetProcAddress(m_handlePython, "PyTuple_Size"); - *reinterpret_cast(&PyString_FromString) = GetProcAddress(m_handlePython, "PyString_FromString"); - *reinterpret_cast(&PyCFunction_NewEx) = GetProcAddress(m_handlePython, "PyCFunction_NewEx"); - *reinterpret_cast(&PySys_GetObject) = GetProcAddress(m_handlePython, "PySys_GetObject"); - *reinterpret_cast(&PySys_SetObject) = GetProcAddress(m_handlePython, "PySys_SetObject"); - *reinterpret_cast(&PySys_SetArgv) = !isPy3 ? GetProcAddress(m_handlePython, "PySys_SetArgv") : 0 ; - *reinterpret_cast(&PySys_SetArgv_Py3) = isPy3 ? GetProcAddress(m_handlePython, "PySys_SetArgv") : 0; - *reinterpret_cast(&PyString_FromString) = GetProcAddress(m_handlePython, "PyString_FromString"); - *reinterpret_cast(&PyString_AsString) = GetProcAddress(m_handlePython, "PyString_AsString"); - *reinterpret_cast(&PyErr_Fetch) = GetProcAddress(m_handlePython, "PyErr_Fetch"); - *reinterpret_cast(&PyErr_NormalizeException) = GetProcAddress(m_handlePython, "PyErr_NormalizeException"); - *reinterpret_cast(&PyErr_SetString) = GetProcAddress(m_handlePython, "PyErr_SetString"); - *reinterpret_cast(&PyErr_Clear) = GetProcAddress(m_handlePython, "PyErr_Clear"); - *reinterpret_cast(&PyImport_AddModule) = GetProcAddress(m_handlePython, "PyImport_AddModule"); - *reinterpret_cast(&PyImport_ImportModule) = GetProcAddress(m_handlePython, "PyImport_ImportModule"); - *reinterpret_cast(&PyImport_Cleanup) = GetProcAddress(m_handlePython, "PyImport_Cleanup"); - *reinterpret_cast(&PyClass_New) = GetProcAddress(m_handlePython, "PyClass_New"); - *reinterpret_cast(&PyInstance_New) = GetProcAddress(m_handlePython, "PyInstance_New"); - *reinterpret_cast(&PyMethod_New) = GetProcAddress(m_handlePython, "PyMethod_New"); - *reinterpret_cast(&PyCapsule_New) = GetProcAddress(m_handlePython, "PyCapsule_New"); - *reinterpret_cast(&PyCapsule_GetPointer) = GetProcAddress(m_handlePython, "PyCapsule_GetPointer"); - *reinterpret_cast(&PyObject_SetAttrString) = GetProcAddress(m_handlePython, "PyObject_SetAttrString"); - *reinterpret_cast(&PyUnicode_FromWideChar) = isPy3 ? GetProcAddress(m_handlePython, "PyUnicode_FromWideChar") : - GetProcAddress(m_handlePython, "PyUnicodeUCS2_FromWideChar"); - *reinterpret_cast(&PyUnicode_AsWideChar) = isPy3 ? GetProcAddress(m_handlePython, "PyUnicode_AsWideChar") : - GetProcAddress(m_handlePython, "PyUnicodeUCS2_AsWideChar"); - *reinterpret_cast(&PyImport_Import) = GetProcAddress(m_handlePython, "PyImport_Import"); - *reinterpret_cast(&PyImport_AddModule) = GetProcAddress(m_handlePython, "PyImport_AddModule"); - *reinterpret_cast(&PyBool_FromLong) = GetProcAddress(m_handlePython, "PyBool_FromLong"); - *reinterpret_cast(&PyList_Size) = GetProcAddress(m_handlePython, "PyList_Size"); - *reinterpret_cast(&PyList_GetItem) = GetProcAddress(m_handlePython, "PyList_GetItem"); - *reinterpret_cast(&PyFile_FromString) = GetProcAddress(m_handlePython, "PyFile_FromString"); - *reinterpret_cast(&PyFile_AsFile) = GetProcAddress(m_handlePython, "PyFile_AsFile"); - *reinterpret_cast(&PyUnicode_FromString) = GetProcAddress(m_handlePython, "PyUnicode_FromString"); - *reinterpret_cast(&PyInstanceMethod_New) = GetProcAddress(m_handlePython, "PyInstanceMethod_New"); - - *reinterpret_cast(&_Py_fopen) = GetProcAddress(m_handlePython, "_Py_fopen"); - *reinterpret_cast(&Py_AddPendingCall) = GetProcAddress(m_handlePython, "Py_AddPendingCall"); - *reinterpret_cast(&PyGILState_Ensure) = GetProcAddress(m_handlePython, "PyGILState_Ensure"); - *reinterpret_cast(&PyGILState_Release) = GetProcAddress(m_handlePython, "PyGILState_Release"); - *reinterpret_cast(&PyDescr_NewMethod) = GetProcAddress(m_handlePython, "PyDescr_NewMethod"); - *reinterpret_cast(&PyGC_Collect) = GetProcAddress(m_handlePython, "PyGC_Collect"); - - - Py_Initialize(); - PyEval_InitThreads(); - - checkPykd(); - - m_globalState = PyEval_SaveThread(); -} - - -PyModule::~PyModule() -{ - assert(0); - - //if (m_globalInterpreter) - //{ - // delete m_globalInterpreter; - // m_globalInterpreter = 0; - //} - - //PyThreadState_Swap(m_globalState); - - //Py_Finalize(); - - //FreeLibrary(m_handlePython); -} - - -void PyModule::deactivate() -{ - if (m_globalInterpreter) - { - delete m_globalInterpreter; - m_globalInterpreter = 0; - - PyThreadState_Swap(m_globalState); - } - else - { - PyEval_RestoreThread(m_globalState); - } - - if (m_pykdInit) - { - PyObject* mainName = isPy3 ? PyUnicode_FromString("__main__") : PyString_FromString("__main__"); - PyObject* mainMod = PyImport_Import(mainName); - PyObject* globals = PyObject_GetAttrString(mainMod, "__dict__"); - PyObject* result = PyRun_String("__import__('pykd').deinitialize()\n", Py_file_input, globals, globals); - - if (mainName) Py_DecRef(mainName); - if (mainMod) Py_DecRef(mainMod); - if (globals) Py_DecRef(globals); - if (result) Py_DecRef(result); - - m_pykdInit = false; - } - - m_globalState = PyEval_SaveThread(); -} - -void PyModule::checkPykd() -{ - - PyObject *mainName = 0, *mainMod = 0, *globals = 0, *result = 0; - - do { - if (m_pykdInit) - break; - - mainName = isPy3 ? PyUnicode_FromString("__main__") : PyString_FromString("__main__"); - if (!mainName) - break; - - mainMod = PyImport_Import(mainName); - if (!mainMod) - break; - - globals = PyObject_GetAttrString(mainMod, "__dict__"); - if (!globals) - break; - - result = PyRun_String("__import__('pykd').initialize()\n", Py_file_input, globals, globals); - if (!result) - break; - - m_pykdInit = true; - - } while( false); - - PyErr_Clear(); - - if (mainName) Py_DecRef(mainName); - if (mainMod) Py_DecRef(mainMod); - if (globals) Py_DecRef(globals); - if (result) Py_DecRef(result); -} - -PythonInterpreter* activateInterpreter(bool global, int majorVersion, int minorVersion) -{ - return PythonSingleton::get()->getInterpreter(majorVersion, minorVersion, global); -} - -void releaseInterpretor(PythonInterpreter* interpret) -{ - PythonSingleton::get()->releaseInterpretor(interpret); -} - -bool isInterpreterLoaded(int majorVersion, int minorVersion) -{ - return PythonSingleton::get()->isInterpreterLoaded(majorVersion, minorVersion); -} - -void stopAllInterpreter() -{ - PythonSingleton::get()->stopAllInterpreter(); -} - -void __stdcall Py_IncRef(PyObject* object) -{ - PythonSingleton::get()->currentInterpreter()->m_module->Py_IncRef(object); -} - -void __stdcall Py_DecRef(PyObject* object) -{ - PythonSingleton::get()->currentInterpreter()->m_module->Py_DecRef(object); -} - -PyObject* __stdcall PyString_FromString(const char *v) -{ - return PythonSingleton::get()->currentInterpreter()->m_module->PyString_FromString(v); -} - -PyObject* __stdcall PyDict_New() -{ - return PythonSingleton::get()->currentInterpreter()->m_module->PyDict_New(); -} - -PyObject* __stdcall PyDict_GetItemString(PyObject *p, const char *key) -{ - return PythonSingleton::get()->currentInterpreter()->m_module->PyDict_GetItemString(p, key); -} - -int __stdcall PyDict_SetItemString(PyObject *p, const char *key, PyObject *val) -{ - return PythonSingleton::get()->currentInterpreter()->m_module->PyDict_SetItemString(p, key, val); -} - -void __stdcall PyDict_Clear(PyObject *p) -{ - return PythonSingleton::get()->currentInterpreter()->m_module->PyDict_Clear(p); -} - -PyObject* __stdcall PyCFunction_NewEx(PyMethodDef* pydef, PyObject *p1, PyObject *p2) -{ - return PythonSingleton::get()->currentInterpreter()->m_module->PyCFunction_NewEx(pydef, p1, p2); -} - -PyObject* __stdcall PyClass_New(PyObject* className, PyObject* classBases, PyObject* classDict) -{ - return PythonSingleton::get()->currentInterpreter()->m_module->PyClass_New(className, classBases, classDict); -} - -PyObject* __stdcall PyMethod_New(PyObject *func, PyObject *self, PyObject *classobj) -{ - return PythonSingleton::get()->currentInterpreter()->m_module->PyMethod_New(func, self, classobj); -} - -int __stdcall PySys_SetObject(char *name, PyObject *v) -{ - return PythonSingleton::get()->currentInterpreter()->m_module->PySys_SetObject(name, v); -} - -void __stdcall PySys_SetArgv(int argc, char **argv) -{ - PythonSingleton::get()->currentInterpreter()->m_module->PySys_SetArgv(argc, argv); -} - -void __stdcall PySys_SetArgv_Py3(int argc, wchar_t **argv) -{ - PythonSingleton::get()->currentInterpreter()->m_module->PySys_SetArgv_Py3(argc, argv); -} - -PyObject* __stdcall PySys_GetObject(char *name) -{ - return PythonSingleton::get()->currentInterpreter()->m_module->PySys_GetObject(name); -} - -PyObject* __stdcall PyInstance_New(PyObject *classobj, PyObject *arg, PyObject *kw) -{ - return PythonSingleton::get()->currentInterpreter()->m_module->PyInstance_New(classobj, arg, kw); -} - -int __stdcall PyRun_SimpleString(const char* str) -{ - return PythonSingleton::get()->currentInterpreter()->m_module->PyRun_SimpleString(str); -} - -PyObject* __stdcall PyRun_String(const char *str, int start, PyObject *globals, PyObject *locals) -{ - return PythonSingleton::get()->currentInterpreter()->m_module->PyRun_String(str, start, globals, locals); -} - -PyObject* PyCapsule_New(void *pointer, const char *name, PyCapsule_Destructor destructor) -{ - return PythonSingleton::get()->currentInterpreter()->m_module->PyCapsule_New(pointer, name, destructor); -} - -void* PyCapsule_GetPointer(PyObject *capsule, const char *name) -{ - return PythonSingleton::get()->currentInterpreter()->m_module->PyCapsule_GetPointer(capsule, name); -} - -int PyObject_SetAttrString(PyObject *o, const char *attr_name, PyObject *v) -{ - return PythonSingleton::get()->currentInterpreter()->m_module->PyObject_SetAttrString(o, attr_name, v); -} - -PyObject* PyObject_GetAttrString(PyObject *o, const char *attr_name) -{ - return PythonSingleton::get()->currentInterpreter()->m_module->PyObject_GetAttrString(o, attr_name); -} - -PyObject* PyObject_CallObject(PyObject *callable_object, PyObject *args) -{ - return PythonSingleton::get()->currentInterpreter()->m_module->PyObject_CallObject(callable_object, args); -} - -PyObject* PyObject_Call(PyObject *callable_object, PyObject *args, PyObject *kw) -{ - return PythonSingleton::get()->currentInterpreter()->m_module->PyObject_Call(callable_object, args, kw); -} - -int PyObject_IsInstance(PyObject *inst, PyObject *cls) -{ - return PythonSingleton::get()->currentInterpreter()->m_module->PyObject_IsInstance(inst,cls); -} - -PyObject* __stdcall PyTuple_New(size_t len) -{ - return PythonSingleton::get()->currentInterpreter()->m_module->PyTuple_New(len); -} - -PyObject* __stdcall PyTuple_GetItem(PyObject *p, size_t pos) -{ - return PythonSingleton::get()->currentInterpreter()->m_module->PyTuple_GetItem(p, pos); -} - -int __stdcall PyTuple_SetItem(PyObject *p, size_t pos, PyObject *obj) -{ - return PythonSingleton::get()->currentInterpreter()->m_module->PyTuple_SetItem(p, pos, obj); -} - -size_t __stdcall PyTuple_Size(PyObject *p) -{ - return PythonSingleton::get()->currentInterpreter()->m_module->PyTuple_Size(p); -} - -char* PyString_AsString(PyObject *string) -{ - return PythonSingleton::get()->currentInterpreter()->m_module->PyString_AsString(string); -} - -PyObject* PyUnicode_FromWideChar(const wchar_t *w, size_t size) -{ - return PythonSingleton::get()->currentInterpreter()->m_module->PyUnicode_FromWideChar(w, size); -} - -PyObject* PyImport_Import(PyObject *name) -{ - return PythonSingleton::get()->currentInterpreter()->m_module->PyImport_Import(name); -} - -PyObject* PyBool_FromLong(long v) -{ - return PythonSingleton::get()->currentInterpreter()->m_module->PyBool_FromLong(v); -} - -PyObject* Py_None() -{ - return PythonSingleton::get()->currentInterpreter()->m_module->Py_None; -} - -PyObject* PyExc_SystemExit() -{ - return PythonSingleton::get()->currentInterpreter()->m_module->PyExc_SystemExit; -} - -PyObject* PyExc_TypeError() -{ - return PythonSingleton::get()->currentInterpreter()->m_module->PyExc_TypeError; -} - -PyObject* PyType_Type() -{ - return PythonSingleton::get()->currentInterpreter()->m_module->PyType_Type; -} - -PyObject* PyProperty_Type() -{ - return PythonSingleton::get()->currentInterpreter()->m_module->PyProperty_Type; -} - -void PyErr_Fetch(PyObject **ptype, PyObject **pvalue, PyObject **ptraceback) -{ - PythonSingleton::get()->currentInterpreter()->m_module->PyErr_Fetch(ptype, pvalue, ptraceback); -} - - -void PyErr_NormalizeException(PyObject**exc, PyObject**val, PyObject**tb) -{ - PythonSingleton::get()->currentInterpreter()->m_module->PyErr_NormalizeException(exc, val, tb); -} - -void PyErr_Clear() -{ - PythonSingleton::get()->currentInterpreter()->m_module->PyErr_Clear(); -} - -void PyErr_SetString(PyObject *type, const char *message) -{ - PythonSingleton::get()->currentInterpreter()->m_module->PyErr_SetString(type, message); -} - -size_t PyList_Size(PyObject* list) -{ - return PythonSingleton::get()->currentInterpreter()->m_module->PyList_Size(list); -} - -PyObject* PyList_GetItem(PyObject *list, size_t index) -{ - return PythonSingleton::get()->currentInterpreter()->m_module->PyList_GetItem(list, index); -} - -PyObject* PyFile_FromString(char *filename, char *mode) -{ - return PythonSingleton::get()->currentInterpreter()->m_module->PyFile_FromString(filename, mode); -} - -FILE* PyFile_AsFile(PyObject *pyfile) -{ - return PythonSingleton::get()->currentInterpreter()->m_module->PyFile_AsFile(pyfile); -} - -PyObject* PyRun_File(FILE *fp, const char *filename, int start, PyObject *globals, PyObject *locals) -{ - return PythonSingleton::get()->currentInterpreter()->m_module->PyRun_File(fp, filename, start, globals, locals); -} - -PyObject* __stdcall PyUnicode_FromString(const char* str) -{ - return PythonSingleton::get()->currentInterpreter()->m_module->PyUnicode_FromString(str); -} - -PyObject* __stdcall PyInstanceMethod_New(PyObject *func) -{ - return PythonSingleton::get()->currentInterpreter()->m_module->PyInstanceMethod_New(func); -} - -size_t __stdcall PyUnicode_AsWideChar(PyObject *unicode, wchar_t *w, size_t size) -{ - return PythonSingleton::get()->currentInterpreter()->m_module->PyUnicode_AsWideChar(unicode, w, size); -} - -PyObject* __stdcall PyImport_ImportModule(const char *name) -{ - return PythonSingleton::get()->currentInterpreter()->m_module->PyImport_ImportModule(name); -} - -PyObject* __stdcall PyImport_AddModule(const char *name) -{ - return PythonSingleton::get()->currentInterpreter()->m_module->PyImport_AddModule(name); -} - -PyThreadState* __stdcall PyEval_SaveThread() -{ - return PythonSingleton::get()->currentInterpreter()->m_module->PyEval_SaveThread(); -} - -void __stdcall PyEval_RestoreThread(PyThreadState *tstate) -{ - PythonSingleton::get()->currentInterpreter()->m_module->PyEval_RestoreThread(tstate); -} - -FILE* _Py_fopen(const char* filename, const char* mode) -{ - return PythonSingleton::get()->currentInterpreter()->m_module->_Py_fopen(filename, mode); -} - -int __stdcall Py_AddPendingCall(int(*func)(void *), void *arg) -{ - return PythonSingleton::get()->currentInterpreter()->m_module->Py_AddPendingCall(func, arg); -} - -PyGILState_STATE __stdcall PyGILState_Ensure() -{ - return PythonSingleton::get()->currentInterpreter()->m_module->PyGILState_Ensure(); -} - -void __stdcall PyGILState_Release(PyGILState_STATE state) -{ - PythonSingleton::get()->currentInterpreter()->m_module->PyGILState_Release(state); -} - -PyObject* __stdcall PyDescr_NewMethod(PyObject* type, struct PyMethodDef *meth) -{ - return PythonSingleton::get()->currentInterpreter()->m_module->PyDescr_NewMethod(type, meth); -} - -size_t __stdcall PyGC_Collect(void) -{ - return PythonSingleton::get()->currentInterpreter()->m_module->PyGC_Collect(); -} - -bool IsPy3() -{ - return PythonSingleton::get()->currentInterpreter()->m_module->isPy3; -} - -int PyString_Check(PyObject *o) -{ - return PythonSingleton::get()->currentInterpreter()->m_module->PyObject_IsInstance(o, - PythonSingleton::get()->currentInterpreter()->m_module->PyString_Type ); -} - -int PyUnicode_Check(PyObject *o) -{ - return PythonSingleton::get()->currentInterpreter()->m_module->PyObject_IsInstance(o, - PythonSingleton::get()->currentInterpreter()->m_module->PyUnicode_Type ); -} - diff --git a/pykd_ext/pyinterpret.h b/pykd_ext/pyinterpret.h deleted file mode 100644 index a9fedbb..0000000 --- a/pykd_ext/pyinterpret.h +++ /dev/null @@ -1,69 +0,0 @@ -#pragma once - -#include -#include - -#include "pymodule.h" - -class PythonInterpreter; - -PythonInterpreter* activateInterpreter(bool global = true, int majorVersion = -1, int minorVersion = -1); - - -void releaseInterpretor(PythonInterpreter* interpret); - -struct InterpreterDesc { - int majorVersion; - int minorVersion; - std::string imagePath; -}; - -inline bool operator < (const InterpreterDesc& d1, const InterpreterDesc& d2) -{ - if (d1.majorVersion != d2.majorVersion) - return d1.majorVersion < d2.majorVersion; - - if (d1.minorVersion != d2.minorVersion) - return d1.minorVersion < d2.minorVersion; - - return d1.imagePath < d2.imagePath; -} - -std::list getInstalledInterpreter(); - -void getDefaultInterpreter(int majorVersion, int minorVersion); - -bool isInterpreterLoaded(int majorVersion, int minorVersion); - -void stopAllInterpreter(); - -void checkPykd(); - - -class AutoInterpreter -{ -public: - - explicit AutoInterpreter(bool global = true, int majorVersion = -1, int minorVersion = -1) - { - m_interpreter = activateInterpreter(global, majorVersion, minorVersion); - } - - ~AutoInterpreter() - { - if (m_interpreter) - releaseInterpretor(m_interpreter); - } - -private: - - AutoInterpreter(const AutoInterpreter&) = delete; - - PythonInterpreter* m_interpreter; -}; - - - - - - diff --git a/pykd_ext/pykd_ext_vc120.vcxproj b/pykd_ext/pykd_ext_vc120.vcxproj deleted file mode 100644 index 8d80b39..0000000 --- a/pykd_ext/pykd_ext_vc120.vcxproj +++ /dev/null @@ -1,228 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {583F9A6C-AF6D-45E0-A8F4-290D93611185} - Win32Proj - pykd_bootstrapper - pykd_ext_2.0 - ..\ - true - - - - DynamicLibrary - true - v120_xp - Unicode - - - DynamicLibrary - true - v120_xp - Unicode - - - DynamicLibrary - false - v120_xp - true - Unicode - - - DynamicLibrary - false - v120_xp - true - Unicode - - - - - - - - - - - - - - - - - - 7f4aed3e - - - true - $(ProjectName) - $(SolutionDir)out\$(Platform)\$(Configuration)\ - - - true - $(ProjectName) - $(SolutionDir)out\$(Platform)\$(Configuration)\ - - - false - $(ProjectName) - $(SolutionDir)out\$(Platform)\$(Configuration)\ - - - false - $(ProjectName) - $(SolutionDir)out\$(Platform)\$(Configuration)\ - - - - Use - Level3 - Disabled - WIN32;_DEBUG;_WINDOWS;_USRDLL;PYKD_BOOTSTRAPPER_EXPORTS;%(PreprocessorDefinitions) - true - $(ProjectDir)..\kdlibcpp\include; - - - Windows - true - export.def - $(OutDir)pykd$(TargetExt) - comsuppw.lib;%(AdditionalDependencies) - - - - - Use - Level3 - Disabled - WIN32;_DEBUG;_WINDOWS;_USRDLL;PYKD_BOOTSTRAPPER_EXPORTS;%(PreprocessorDefinitions) - true - $(ProjectDir)..\kdlibcpp\include; - - - Windows - true - export.def - $(OutDir)pykd$(TargetExt) - comsuppw.lib;%(AdditionalDependencies) - - - - - Level3 - Use - MaxSpeed - true - true - WIN32;NDEBUG;_WINDOWS;_USRDLL;PYKD_BOOTSTRAPPER_EXPORTS;%(PreprocessorDefinitions) - true - $(ProjectDir)..\kdlibcpp\include; - MultiThreaded - - - Windows - true - true - true - export.def - $(OutDir)pykd$(TargetExt) - comsuppw.lib;%(AdditionalDependencies) - - - - - Level3 - Use - MaxSpeed - true - true - WIN32;NDEBUG;_WINDOWS;_USRDLL;PYKD_BOOTSTRAPPER_EXPORTS;%(PreprocessorDefinitions) - true - $(ProjectDir)..\kdlibcpp\include; - MultiThreaded - - - Windows - true - true - true - export.def - $(OutDir)pykd$(TargetExt) - comsuppw.lib;%(AdditionalDependencies) - - - - - - - - - - - - - - - - - - - false - false - - - - - false - false - - - - - - - - Create - Create - Create - Create - - - - - - - - - - - - - - - - - This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - - \ No newline at end of file diff --git a/pykd_ext/pykd_ext_vc120.vcxproj.filters b/pykd_ext/pykd_ext_vc120.vcxproj.filters deleted file mode 100644 index 6c8784f..0000000 --- a/pykd_ext/pykd_ext_vc120.vcxproj.filters +++ /dev/null @@ -1,79 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;hm;inl;inc;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - - - Source Files - - - - - Resource Files - - - \ No newline at end of file diff --git a/pykd_ext/pymodule.h b/pykd_ext/pymodule.h deleted file mode 100644 index e0af157..0000000 --- a/pykd_ext/pymodule.h +++ /dev/null @@ -1,10 +0,0 @@ -#pragma once - -#include - -#include "pyapi.h" - - - - - diff --git a/pykd_ext/resource.h b/pykd_ext/resource.h deleted file mode 100644 index c3bc570..0000000 --- a/pykd_ext/resource.h +++ /dev/null @@ -1,14 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by version.rc - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 101 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1001 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif diff --git a/pykd_ext/stdafx.cpp b/pykd_ext/stdafx.cpp deleted file mode 100644 index 75c83a9..0000000 --- a/pykd_ext/stdafx.cpp +++ /dev/null @@ -1,8 +0,0 @@ -// stdafx.cpp : source file that includes just the standard includes -// pykd_bootstrapper.pch will be the pre-compiled header -// stdafx.obj will contain the pre-compiled type information - -#include "stdafx.h" - -// TODO: reference any additional headers you need in STDAFX.H -// and not in this file diff --git a/pykd_ext/stdafx.h b/pykd_ext/stdafx.h deleted file mode 100644 index 821888c..0000000 --- a/pykd_ext/stdafx.h +++ /dev/null @@ -1,18 +0,0 @@ -// stdafx.h : include file for standard system include files, -// or project specific include files that are used frequently, but -// are changed infrequently -// - -#pragma once - -#include "targetver.h" - -#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers -// Windows Header Files: -#include - -#include - -#define BOOST_PYTHON_STATIC_LIB - -// TODO: reference additional headers your program requires here diff --git a/pykd_ext/targetver.h b/pykd_ext/targetver.h deleted file mode 100644 index 90e767b..0000000 --- a/pykd_ext/targetver.h +++ /dev/null @@ -1,8 +0,0 @@ -#pragma once - -// Including SDKDDKVer.h defines the highest available Windows platform. - -// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and -// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. - -#include diff --git a/pykd_ext/version.h b/pykd_ext/version.h deleted file mode 100644 index 147e498..0000000 --- a/pykd_ext/version.h +++ /dev/null @@ -1,15 +0,0 @@ -#pragma once - -#define PYKDEXT_VERSION_MAJOR 2 -#define PYKDEXT_VERSION_MINOR 0 -#define PYKDEXT_VERSION_SUBVERSION 0 -#define PYKDEXT_VERSION_BUILDNO 16 - -#define __VER_STR2__(x) #x -#define __VER_STR1__(x) __VER_STR2__(x) - -#define PYKDEXT_VERSION_BUILD_COMMA PYKDEXT_VERSION_MAJOR, PYKDEXT_VERSION_MINOR, PYKDEXT_VERSION_SUBVERSION, PYKDEXT_VERSION_BUILDNO -#define PYKDEXT_VERSION_BUILD PYKDEXT_VERSION_MAJOR.PYKDEXT_VERSION_MINOR.PYKDEXT_VERSION_SUBVERSION.PYKDEXT_VERSION_BUILDNO - -#define PYKDEXT_VERSION_BUILD_STR_COMMA __VER_STR1__(PYKDEXT_VERSION_BUILD_COMMA) -#define PYKDEXT_VERSION_BUILD_STR __VER_STR1__(PYKDEXT_VERSION_BUILD) diff --git a/pykd_ext/version.rc b/pykd_ext/version.rc deleted file mode 100644 index d21dc69..0000000 Binary files a/pykd_ext/version.rc and /dev/null differ diff --git a/pykd_ext/windbgext.cpp b/pykd_ext/windbgext.cpp deleted file mode 100644 index 667fce3..0000000 --- a/pykd_ext/windbgext.cpp +++ /dev/null @@ -1,802 +0,0 @@ -#include "stdafx.h" - -#include -#include -#include -#include -#include -#include - -#include - -#include "dbgout.h" -#include "arglist.h" -#include "pyinterpret.h" -#include "pyapi.h" -#include "pyclass.h" -#include "version.h" - -////////////////////////////////////////////////////////////////////////////// - -static int defaultMajorVersion = 2; -static int defaultMinorVersion = 7; - -////////////////////////////////////////////////////////////////////////////// - -void handleException(); -std::string getScriptFileName(const std::string &scriptName); -void getPythonVersion(int& majorVersion, int& minorVersion); -void getDefaultPythonVersion(int& majorVersion, int& minorVersion); -void printString(PDEBUG_CLIENT client, ULONG mask, const char* str); - -////////////////////////////////////////////////////////////////////////////// - -class InterruptWatch -{ -public: - - InterruptWatch(PDEBUG_CLIENT client) - { - m_control = client; - m_stopEvent = CreateEvent(NULL, TRUE, FALSE, NULL); - m_thread = CreateThread(NULL, 0, threadRoutine, this, 0, NULL); - } - - ~InterruptWatch() - { - SetEvent(m_stopEvent); - WaitForSingleObject(m_thread, INFINITE); - CloseHandle(m_stopEvent); - CloseHandle(m_thread); - } - - static int quit(void *context) - { - HANDLE quitEvent = (HANDLE)context; - PyErr_SetString(PyExc_SystemExit(), "CTRL+BREAK"); - SetEvent(quitEvent); - return -1; - } - -private: - - static DWORD WINAPI threadRoutine(LPVOID lpParameter) { - return static_cast(lpParameter)->interruptWatchRoutine(); - } - - DWORD InterruptWatch::interruptWatchRoutine() - { - while (WAIT_TIMEOUT == WaitForSingleObject(m_stopEvent, 250)) - { - HRESULT hres = m_control->GetInterrupt(); - if (hres == S_OK) - { - HANDLE quitEvent = CreateEvent(NULL, FALSE, FALSE, NULL); - PyGILState_STATE state = PyGILState_Ensure(); - Py_AddPendingCall(&quit, (void*)quitEvent); - PyGILState_Release(state); - WaitForSingleObject(quitEvent, INFINITE); - CloseHandle(quitEvent); - } - } - - return 0; - } - - HANDLE m_thread; - - HANDLE m_stopEvent; - - CComQIPtr m_control; -}; - -////////////////////////////////////////////////////////////////////////////// - -extern "C" -HRESULT -CALLBACK -DebugExtensionInitialize( - PULONG Version, - PULONG Flags -) -{ - return S_OK; -} - -////////////////////////////////////////////////////////////////////////////// - -extern "C" -VOID -CALLBACK -DebugExtensionUninitialize() -{ - stopAllInterpreter(); -} - -////////////////////////////////////////////////////////////////////////////// - -std::string make_version(int major, int minor) -{ - std::stringstream sstr; - sstr << std::dec << major << '.' << minor; - -#ifdef _WIN64 - - sstr << " x86-64"; - -#else - - sstr << " x86-32"; - -#endif - - return sstr.str(); -} - -extern "C" -HRESULT -CALLBACK -info( - PDEBUG_CLIENT client, - PCSTR args -) -{ - try - { - std::stringstream sstr; - - sstr < interpreterList = getInstalledInterpreter(); - - int defaultMajor; - int defaultMinor; - - getDefaultPythonVersion(defaultMajor, defaultMinor); - - sstr << std::endl << "Installed python:" << std::endl << std::endl; - sstr << std::setw(16) << std::left << "Version:" << std::setw(12) << std::left << "Status: " << std::left << "Image:" << std::endl; - sstr << "------------------------------------------------------------------------------" << std::endl; - if (interpreterList.size() > 0) - { - for (const InterpreterDesc& desc : interpreterList) - { - if ( defaultMajor == desc.majorVersion && defaultMinor == desc.minorVersion) - sstr << "* "; - else - sstr << " "; - - sstr << std::setw(14) << std::left << make_version(desc.majorVersion, desc.minorVersion); - - sstr << std::setw(12) << std::left << (isInterpreterLoaded(desc.majorVersion, desc.minorVersion) ? "Loaded" : "Unloaded"); - - sstr << desc.imagePath << std::endl; - } - } - else - { - sstr << "No python interpreter found" << std::endl; - } - - sstr << std::endl; - - printString(client, DEBUG_OUTPUT_NORMAL, sstr.str().c_str() ); - } - catch(std::exception &e) - { - printString(client, DEBUG_OUTPUT_ERROR, e.what() ); - } - - return S_OK; -} - -////////////////////////////////////////////////////////////////////////////// - -extern "C" -HRESULT -CALLBACK -selectVersion( - PDEBUG_CLIENT client, - PCSTR args -) -{ - Options opts(args); - - int majorVersion = opts.pyMajorVersion; - int minorVersion = opts.pyMinorVersion; - - getPythonVersion(majorVersion, minorVersion); - - if ( opts.pyMajorVersion == majorVersion && opts.pyMinorVersion == minorVersion ) - { - defaultMajorVersion = majorVersion; - defaultMinorVersion = minorVersion; - } - - return S_OK; -} - -////////////////////////////////////////////////////////////////////////////// - -static const char printUsageMsg[] = - "\n" - "usage:\n" - "\n" - "!help\n" - "\tprint this text\n" - "\n" - "!info\n" - "\tlist installed python interpreters\n" - "\n" - "!select version\n" - "\tchange default version of a python interpreter\n" - "\n" - "!py [version] [options] [file]\n" - "\trun python script or REPL\n" - "\n" - "\tVersion:\n" - "\t-2 : use Python2\n" - "\t-2.x : use Python2.x\n" - "\t-3 : use Python3\n" - "\t-3.x : use Python3.x\n" - "\n" - "\tOptions:\n" - "\t-g --global : run code in the common namespace\n" - "\t-l --local : run code in the isolated namespace\n" - "\t-m --module : run module as the __main__ module ( see the python command line option -m )\n" - "\n" - "\tcommand samples:\n" - "\t\"!py\" : run REPL\n" - "\t\"!py --local\" : run REPL in the isolated namespace\n" - "\t\"!py -g script.py 10 \"string\"\" : run a script file with an argument in the commom namespace\n" - "\t\"!py -m module_name\" : run a named module as the __main__\n" - "\n" - "!pip [version] [args]\n" - "\trun pip package manager\n" - "\n" - "\tVersion:\n" - "\t-2 : use Python2\n" - "\t-2.x : use Python2.x\n" - "\t-3 : use Python3\n" - "\t-3.x : use Python3.x\n" - "\n" - "\tpip command samples:\n" - "\t\"pip list\" : show all installed packagies\n" - "\t\"pip install pykd\" : install pykd\n" - "\t\"pip install --upgrade pykd\" : upgrade pykd to the latest version\n" - "\t\"pip show pykd\" : show info about pykd package\n" - ; - - -////////////////////////////////////////////////////////////////////////////// - -extern "C" -HRESULT -CALLBACK -help( - PDEBUG_CLIENT client, - PCSTR args - ) -{ - CComQIPtr control = client; - - control->ControlledOutput( - DEBUG_OUTCTL_AMBIENT_TEXT, - DEBUG_OUTPUT_NORMAL, - "%s", - printUsageMsg - ); - - return S_OK; -} - -////////////////////////////////////////////////////////////////////////////// - - -static const std::regex shebangRe("^#!\\s*python([2,3])(?:\\.(\\d))?$"); - -static volatile long recursiveGuard = 0L; - -extern "C" -HRESULT -CALLBACK -py( - PDEBUG_CLIENT client, - PCSTR args -) -{ - - ULONG oldMask; - client->GetOutputMask(&oldMask); - client->SetOutputMask(DEBUG_OUTPUT_NORMAL|DEBUG_OUTPUT_ERROR|DEBUG_OUTPUT_WARNING|DEBUG_OUTPUT_DEBUGGEE ); - - try { - - if ( 1 < ++recursiveGuard ) - throw std::exception( "can not run !py command recursive\n"); - - Options opts(args); - - if (opts.showHelp) - throw std::exception(printUsageMsg); - - int majorVersion = opts.pyMajorVersion; - int minorVersion = opts.pyMinorVersion; - - std::string scriptFileName; - - if ( opts.args.size() > 0 && !opts.runModule ) - { - scriptFileName = getScriptFileName(opts.args[0]); - if ( scriptFileName.empty() ) - throw std::invalid_argument("script not found\n"); - } - - if ( !opts.runModule && majorVersion == -1 && minorVersion == -1 ) - { - std::ifstream scriptFile(scriptFileName); - - if ( scriptFile.is_open() ) - { - std::string firstline; - std::getline(scriptFile, firstline); - - std::smatch mres; - if (std::regex_match(firstline, mres, shebangRe)) - { - majorVersion = atol(std::string(mres[1].first, mres[1].second).c_str()); - - if (mres[2].matched) - { - minorVersion = atol(std::string(mres[2].first, mres[2].second).c_str()); - } - } - } - } - - getPythonVersion(majorVersion, minorVersion); - - AutoInterpreter autoInterpreter(opts.global, majorVersion, minorVersion); - - PyObjectRef mainMod = PyImport_ImportModule("__main__"); - PyObjectRef globals = PyObject_GetAttrString(mainMod, "__dict__"); - - PyObjectRef dbgOut = make_pyobject(client); - PySys_SetObject("stdout", dbgOut); - - PyObjectRef dbgErr = make_pyobject(client); - PySys_SetObject("stderr", dbgErr); - - PyObjectRef dbgIn = make_pyobject(client); - PySys_SetObject("stdin", dbgIn); - - InterruptWatch interruptWatch(client); - - PyRun_String("import sys\nsys.setrecursionlimit(500)\n", Py_file_input, globals, globals); - - if (opts.args.empty()) - { - PyObjectRef result = PyRun_String("import pykd\nfrom pykd import *\n", Py_file_input, globals, globals); - PyErr_Clear(); - result = PyRun_String("import code\ncode.InteractiveConsole(globals()).interact()\n", Py_file_input, globals, globals); - } - else - { - if (IsPy3()) - { - std::wstring scriptFileNameW = _bstr_t(scriptFileName.c_str()); - - // óñòàíàâèëèâàåì ïèòîíîâñêèå àðãóìåíòû - std::vector argws(opts.args.size()); - - if ( !scriptFileNameW.empty() ) - argws[0] = scriptFileNameW; - else - argws[0] = L""; - - for (size_t i = 1; i < opts.args.size(); ++i) - argws[i] = _bstr_t(opts.args[i].c_str()); - - std::vector pythonArgs(opts.args.size()); - for (size_t i = 0; i < opts.args.size(); ++i) - pythonArgs[i] = const_cast(argws[i].c_str()); - - PySys_SetArgv_Py3((int)opts.args.size(), &pythonArgs[0]); - - if ( opts.runModule ) - { - std::stringstream sstr; - sstr << "runpy.run_module(\"" << opts.args[0] << "\", run_name='__main__', alter_sys=True)" << std::endl; - - PyObjectRef result; - result = PyRun_String("import runpy\n", Py_file_input, globals, globals); - result = PyRun_String(sstr.str().c_str(), Py_file_input, globals, globals); - } - else - { - FILE* fs = _Py_fopen(scriptFileName.c_str(), "r"); - if ( !fs ) - throw std::invalid_argument("script not found\n"); - - PyObjectRef result = PyRun_File(fs, scriptFileName.c_str(), Py_file_input, globals, globals); - } - } - else - { - std::vector pythonArgs(opts.args.size()); - - if ( !scriptFileName.empty() ) - pythonArgs[0] = const_cast(scriptFileName.c_str()); - else - pythonArgs[0] = ""; - - for (size_t i = 1; i < opts.args.size(); ++i) - pythonArgs[i] = const_cast(opts.args[i].c_str()); - - PySys_SetArgv((int)opts.args.size(), &pythonArgs[0]); - - if ( opts.runModule ) - { - std::stringstream sstr; - sstr << "runpy.run_module('" << opts.args[0] << "', run_name='__main__', alter_sys=True)" << std::endl; - - PyObjectRef result; - result = PyRun_String("import runpy\n", Py_file_input, globals, globals); - result = PyRun_String(sstr.str().c_str(), Py_file_input, globals, globals); - } - else - { - PyObjectRef pyfile = PyFile_FromString(const_cast(scriptFileName.c_str()), "r"); - if (!pyfile) - throw std::invalid_argument("script not found\n"); - - FILE *fs = PyFile_AsFile(pyfile); - - PyObjectRef result = PyRun_File(fs, scriptFileName.c_str(), Py_file_input, globals, globals); - } - } - } - - handleException(); - - if ( !opts.global ) - PyDict_Clear(globals); - } - catch (std::exception &e) - { - printString(client, DEBUG_OUTPUT_ERROR, e.what() ); - } - - client->SetOutputMask(oldMask); - - --recursiveGuard; - - return S_OK; -} - -////////////////////////////////////////////////////////////////////////////// - -extern "C" -HRESULT -CALLBACK -pip( - PDEBUG_CLIENT client, - PCSTR args -) -{ - - try { - - if ( 1 < ++recursiveGuard ) - throw std::exception( "can not run !pip command recursive\n"); - - Options opts(args); - - int majorVersion = opts.pyMajorVersion; - int minorVersion = opts.pyMinorVersion; - - getPythonVersion(majorVersion, minorVersion); - - AutoInterpreter autoInterpreter(true, majorVersion, minorVersion); - - PyObjectRef dbgOut = make_pyobject(client); - PySys_SetObject("stdout", dbgOut); - - PyObjectRef dbgErr = make_pyobject(client); - PySys_SetObject("stderr", dbgErr); - - PyObjectRef dbgIn = make_pyobject(client); - PySys_SetObject("stdin", dbgIn); - - PyObjectRef mainName = IsPy3() ? PyUnicode_FromString("__main__") : PyString_FromString("__main__"); - PyObjectRef mainMod = PyImport_Import(mainName); - PyObjectRef globals = PyObject_GetAttrString(mainMod, "__dict__"); - - - std::stringstream sstr; - sstr << "pip.main(["; - for (auto arg : opts.args) - sstr << '\'' << arg << '\'' << ','; - sstr << "])\n"; - - PyObjectRef result; - result = PyRun_String("import pip\n", Py_file_input, globals, globals); - result = PyRun_String("pip.logger.consumers = []\n", Py_file_input, globals, globals); - result = PyRun_String(sstr.str().c_str(), Py_file_input, globals, globals); - - handleException(); - } - catch (std::exception &e) - { - printString(client, DEBUG_OUTPUT_ERROR, e.what() ); - } - - --recursiveGuard; - - return S_OK; -} - -////////////////////////////////////////////////////////////////////////////// - -void handleException() -{ - // îøèáêà â ñêðèïòå - PyObject *errtype = NULL, *errvalue = NULL, *traceback = NULL; - - PyErr_Fetch(&errtype, &errvalue, &traceback); - - PyErr_NormalizeException(&errtype, &errvalue, &traceback); - - if (errtype && errtype != PyExc_SystemExit()) - { - PyObjectRef traceback_module = PyImport_ImportModule("traceback"); - - std::stringstream sstr; - - PyObjectRef format_exception = PyObject_GetAttrString(traceback_module, "format_exception"); - - PyObjectRef args = PyTuple_New(3); - PyTuple_SetItem(args, 0, errtype ? errtype : Py_None()); - PyTuple_SetItem(args, 1, errvalue ? errvalue : Py_None()); - PyTuple_SetItem(args, 2, traceback ? traceback : Py_None()); - - PyObjectRef lst = PyObject_Call(format_exception, args, NULL); - - sstr << std::endl << std::endl; - - for (size_t i = 0; i < PyList_Size(lst); ++i) - { - PyObjectBorrowedRef item = PyList_GetItem(lst, i); - sstr << std::string(convert_from_python(item)) << std::endl; - } - - throw std::exception(sstr.str().c_str()); - } - - if (errtype) Py_DecRef(errtype); - if (errvalue) Py_DecRef(errvalue); - if (traceback) Py_DecRef(traceback); -} - -/////////////////////////////////////////////////////////////////////////////// - -void getPathList( std::list &pathStringLst) -{ - PyObjectBorrowedRef pathLst = PySys_GetObject("path"); - - size_t pathLstSize = PyList_Size(pathLst); - - for (size_t i = 0; i < pathLstSize; i++) - { - PyObjectBorrowedRef pathLstItem = PyList_GetItem(pathLst, i); - - if ( IsPy3() ) - { - std::vector buf(0x10000); - size_t len = buf.size(); - PyUnicode_AsWideChar(pathLstItem, &buf[0], len); - - DWORD attr = GetFileAttributesW(&buf[0]); - if ( attr == INVALID_FILE_ATTRIBUTES || (attr & FILE_ATTRIBUTE_DIRECTORY ) == 0 ) - continue; - - pathStringLst.push_back( std::string(_bstr_t(&buf[0]))); - } - else - { - char* path = PyString_AsString(pathLstItem); - - DWORD attr = GetFileAttributesA(path); - if ( attr == INVALID_FILE_ATTRIBUTES || (attr & FILE_ATTRIBUTE_DIRECTORY ) == 0 ) - continue; - - pathStringLst.push_back(path); - } - } -} - -/////////////////////////////////////////////////////////////////////////////// - -std::string getScriptFileName(const std::string &scriptName) -{ - char* ext = NULL; - - DWORD searchResult = - SearchPathA( - NULL, - scriptName.c_str(), - NULL, - 0, - NULL, - NULL ); - - if ( searchResult == 0 ) - { - ext = ".py"; - - searchResult = - SearchPathA( - NULL, - scriptName.c_str(), - ext, - 0, - NULL, - NULL ); - - if ( searchResult == 0 ) - { - return ""; - } - } - - std::vector pathBuffer(searchResult); - - searchResult = - SearchPathA( - NULL, - scriptName.c_str(), - ext, - pathBuffer.size(), - &pathBuffer.front(), - NULL ); - - return std::string(&pathBuffer.front(), searchResult); -} - -/////////////////////////////////////////////////////////////////////////////// - -void getPythonVersion(int& majorVersion, int& minorVersion) -{ - if (majorVersion == -1 && minorVersion == -1 ) - return getDefaultPythonVersion(majorVersion, minorVersion); - - std::list interpreterList = getInstalledInterpreter(); - - bool found = false; - bool anyMinorVersion = minorVersion == -1; - bool anyMajorVersion = majorVersion == -1; - - if (anyMajorVersion) - { - for (auto interpret : interpreterList) - { - - if (2 == interpret.majorVersion && - anyMinorVersion ? (minorVersion <= interpret.minorVersion) : (minorVersion == interpret.minorVersion)) - { - found = true; - minorVersion = interpret.minorVersion; - } - } - - if (found) - { - majorVersion = 2; - return; - } - } - - for (auto interpret : interpreterList) - { - if (anyMajorVersion ? (majorVersion <= interpret.majorVersion) : (majorVersion==interpret.majorVersion) && - anyMinorVersion ? (minorVersion <= interpret.minorVersion) : (minorVersion == interpret.minorVersion)) - { - found = true; - minorVersion = interpret.minorVersion; - majorVersion = interpret.majorVersion; - } - } - - if (!found) - throw std::exception("failed to find python interpreter\n"); -} - -/////////////////////////////////////////////////////////////////////////////// - -void getDefaultPythonVersion(int& majorVersion, int& minorVersion) -{ - std::list interpreterList = getInstalledInterpreter(); - - bool found = false; - majorVersion = -1; - minorVersion = -1; - - for (auto interpret : interpreterList) - { - if (defaultMajorVersion == interpret.majorVersion && defaultMinorVersion == interpret.minorVersion) - { - majorVersion = defaultMajorVersion; - minorVersion = defaultMinorVersion; - return; - } - } - - for (auto interpret : interpreterList) - { - if (2 == interpret.majorVersion && minorVersion <= interpret.minorVersion ) - { - found = true; - majorVersion = interpret.majorVersion; - minorVersion = interpret.minorVersion; - } - } - - if (found) - return; - - for (auto interpret : interpreterList) - { - if (3 == interpret.majorVersion && minorVersion <= interpret.minorVersion ) - { - found = true; - majorVersion = interpret.majorVersion; - minorVersion = interpret.minorVersion; - } - } - - if (found) - return; - - if (!found) - throw std::exception("failed to find python interpreter\n"); -} - -/////////////////////////////////////////////////////////////////////////////// - -void printString(PDEBUG_CLIENT client, ULONG mask, const char* str) -{ - CComQIPtr control = client; - - ULONG engOpts; - bool prefer_dml = SUCCEEDED(control->GetEngineOptions(&engOpts)) && ( (engOpts & DEBUG_ENGOPT_PREFER_DML ) != 0 ); - - std::stringstream sstr(str); - while( sstr.good() ) - { - std::string line; - std::getline(sstr, line); - - if ( prefer_dml && mask == DEBUG_OUTPUT_ERROR ) - { - control->ControlledOutput( - DEBUG_OUTCTL_AMBIENT_DML, - mask, - "%s\n", - line.c_str() - ); - } - else - { - control->ControlledOutput( - DEBUG_OUTCTL_AMBIENT_TEXT, - mask, - "%s\n", - line.c_str() - ); - } - } - -} - -///////////////////////////////////////////////////////////////////////////////