Skip to content

How to build and debug

Jingang Guo, KK edited this page Sep 8, 2015 · 10 revisions

This project is build under VisualStudio Express 2013 for Desktop, you can download the tool on Microsoft.com for free.

[How to Build]

Clone the repository

git clone https://github.com/kkguo/apkshellext.git

update submodule

cd apkshellext/ApkShellext2
git submodule init
git submodule update

Or use one line command

git clone --recursive https://github.com/kkguo/apkshellext.git
  • Start the project with VS express
  • if you see file missing here, remove it from project file list, should be ok without those files.
  • Create a key for yourself. see MSDN
  • Build the solution
  • Go to bin/Debug, run install to register

[Build with new language]

  • Download the translation from http://translate.apkshellext.com, it will be a resx file named as Resources.< your language code > .resx, The language code is defined as [this Microsoft page] (https://msdn.microsoft.com/en-us/library/ee825488(v=cs.20).aspx) for your language code.
  • Add the resx file into the Properties folder in Visual studio (VS).
  • Run debug build for one time, and you will get the language resource dll under bin/debug/< lang-code >/ApkShellext2.resources.dll, create a new folder named as < lang-code > under Resources/ in VS Solution view and move the dll into that folder.
  • Set the property BuildOperation as "Embedded Resource".
  • Build the second time. The language will be included and enumerated automatically.
  • Update the PostBuildEvent with the move command, so the dll will be updated automatically after each build.

[How to Debug]

  • Log, Using the diagnostics feature from SharpShell
    HKEY_LOCAL_MACHINE\Software\SharpShell\LogMode = 4
    HKEY_LOCAL_MACHINE\Software\SharpShell\LogPath = <your log file path>
  • Stepping the register process, you need to manually change the debug option, as C# express is not officially supporting this (but actually it does work)
    • Close up VS express.
    • open ApkShellext2.csproj.user with a text editor.
    • un-comment
 <!-- Debug the registry process, please uncomment this part
	<StartAction>Program</StartAction>
	<StartProgram>C:\Windows\Microsoft.NET\Framework64\v4.0.30319\regasm.exe</StartProgram>
   
<StartWorkingDirectory>C:\Users\guojin\Documents\Brews\ApkShellext2\ApkShellext2\bin\Debug\</StartWorkingDirectory>
    <StartArguments>/codebase apkshellext2.dll</StartArguments>  -->
* change the path according to your setting
* Open VS express **as administrator**
* set your break point
* Click Run button. 
  • Stepping the handlers

    • Build the whole project, if you cannot write into the dll, run restart_explorer.bat under bin/Debug
    • Debug -> attach to process, find explorer.exe, OK
    • set break point in the handler code
    • Open a folder with apk files, and if you are triggering the handler, you should get to the break point.
  • Some Hints

    • if you cannot set the break point, check following registry key, it's listing one or more version numbers. remove those version you are not using, or remove the whole sub key if you don't know and restart the install.bat.
    HKEY_CLASSES_ROOT\CLSID\{1F869CEE-4FDA-35D9-896F-43975A87D1F6}\InprocServer32
    HKEY_CLASSES_ROOT\CLSID\{dcb629fc-f86f-456f-8e24-98b9b2643a9b}\InprocServer32
    HKEY_CLASSES_ROOT\CLSID\{946435a5-fe96-416d-99db-e94ee9fb46c8}\InprocServer32