├── .gitignore ├── FastCopy.mak ├── FastCopy.mdp ├── FastCopy.sln ├── FastCopy.vcproj ├── FastCopy.vcxproj ├── README.md ├── help ├── Index.hhk ├── email2.png ├── fastcopy.hhc ├── fastcopy.hhk ├── fastcopy.hhp ├── fastcopy.htm └── fastcopy_eng.htm ├── install.vcproj ├── install.vcxproj ├── readme.txt ├── readme_eng.txt ├── shellex64.vcproj ├── shellex64.vcxproj ├── shellext.vcproj ├── shellext.vcxproj └── src ├── cfg.cpp ├── cfg.h ├── fastcopy.cpp ├── fastcopy.exe.manifest ├── fastcopy.h ├── fastcopy.ico ├── fastcopy.rc ├── fastcopy2.ico ├── fastcopy3.ico ├── fastcopy4.ico ├── fcwait.ico ├── install ├── install.cpp ├── install.h ├── install.rc ├── instrc.h ├── setup.exe.manifest └── setup.ico ├── mainwin.cpp ├── mainwin.h ├── miscdlg.cpp ├── miscdlg.h ├── regexp.cpp ├── regexp.h ├── resource.h ├── shellext ├── FastEx64.dll.manifest ├── resource.h ├── shell64.def ├── shelldef.h ├── shellext.cpp ├── shellext.def ├── shellext.h └── shellext.rc ├── tlib ├── tapi32ex.cpp ├── tapi32ex.h ├── tapi32u8.cpp ├── tapi32u8.h ├── tapi32v.cpp ├── tapi32v.h ├── tapp.cpp ├── tdlg.cpp ├── tini.cpp ├── tlib.h ├── tlist.cpp ├── tmisc.cpp ├── tregist.cpp └── twin.cpp ├── utility.cpp ├── utility.h ├── version.cpp └── version.h /.gitignore: -------------------------------------------------------------------------------- 1 | /Debug 2 | /Release 3 | /_UpgradeReport_Files 4 | /FastCopy.ncb 5 | /UpgradeLog.XML 6 | /FastCopy.suo 7 | /FastCopy.vcproj.Chez-Lau.Laurent_2.user 8 | /setup.exe 9 | /setup.ilk 10 | /shellext.vcproj.Chez-Lau.Laurent_2.user 11 | /FastCopy.opensdf 12 | /FastCopy.sdf 13 | /FastCopy.vcxproj.filters 14 | /FastCopy.vcxproj.user 15 | /UpgradeLog2.XML 16 | /install.vcproj.Chez-Lau.Laurent_2.user 17 | /install.vcxproj.filters 18 | /install.vcxproj.user 19 | /shellex64.vcproj.Chez-Lau.Laurent_2.user 20 | /shellex64.vcxproj.filters 21 | /shellex64.vcxproj.user 22 | /shellext.vcxproj.filters 23 | /shellext.vcxproj.user 24 | /src/NOTES.txt 25 | /ipch 26 | /FastCopy.exe 27 | /FastCopy.ini -------------------------------------------------------------------------------- /FastCopy.mak: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/laurent22/fastcopy/96b6c6b236a53763c3a011aae78d3be6f8bc3c85/FastCopy.mak -------------------------------------------------------------------------------- /FastCopy.mdp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/laurent22/fastcopy/96b6c6b236a53763c3a011aae78d3be6f8bc3c85/FastCopy.mdp -------------------------------------------------------------------------------- /FastCopy.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 11.00 3 | # Visual C++ Express 2010 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "shellext", "shellext.vcxproj", "{DD8C289F-DDEB-4664-A8CD-65A2B067A1DF}" 5 | EndProject 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "install", "install.vcxproj", "{81F0F7E1-E0A4-4907-9BBD-B13B5B19474A}" 7 | EndProject 8 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "shellex64", "shellex64.vcxproj", "{670B6D36-1AFE-463D-8311-D929C25AF68E}" 9 | EndProject 10 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FastCopy", "FastCopy.vcxproj", "{D6FF3145-1A10-4739-8E42-C5327BF51584}" 11 | EndProject 12 | Global 13 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 14 | Debug|Win32 = Debug|Win32 15 | Debug|x64 = Debug|x64 16 | Release|Win32 = Release|Win32 17 | Release|x64 = Release|x64 18 | EndGlobalSection 19 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 20 | {DD8C289F-DDEB-4664-A8CD-65A2B067A1DF}.Debug|Win32.ActiveCfg = Debug|Win32 21 | {DD8C289F-DDEB-4664-A8CD-65A2B067A1DF}.Debug|x64.ActiveCfg = Debug|x64 22 | {DD8C289F-DDEB-4664-A8CD-65A2B067A1DF}.Release|Win32.ActiveCfg = Release|Win32 23 | {DD8C289F-DDEB-4664-A8CD-65A2B067A1DF}.Release|x64.ActiveCfg = Release|x64 24 | {81F0F7E1-E0A4-4907-9BBD-B13B5B19474A}.Debug|Win32.ActiveCfg = Debug|Win32 25 | {81F0F7E1-E0A4-4907-9BBD-B13B5B19474A}.Debug|x64.ActiveCfg = Debug|x64 26 | {81F0F7E1-E0A4-4907-9BBD-B13B5B19474A}.Debug|x64.Build.0 = Debug|x64 27 | {81F0F7E1-E0A4-4907-9BBD-B13B5B19474A}.Release|Win32.ActiveCfg = Release|Win32 28 | {81F0F7E1-E0A4-4907-9BBD-B13B5B19474A}.Release|x64.ActiveCfg = Release|x64 29 | {81F0F7E1-E0A4-4907-9BBD-B13B5B19474A}.Release|x64.Build.0 = Release|x64 30 | {670B6D36-1AFE-463D-8311-D929C25AF68E}.Debug|Win32.ActiveCfg = Debug|Win32 31 | {670B6D36-1AFE-463D-8311-D929C25AF68E}.Debug|x64.ActiveCfg = Debug|x64 32 | {670B6D36-1AFE-463D-8311-D929C25AF68E}.Debug|x64.Build.0 = Debug|x64 33 | {670B6D36-1AFE-463D-8311-D929C25AF68E}.Release|Win32.ActiveCfg = Release|Win32 34 | {670B6D36-1AFE-463D-8311-D929C25AF68E}.Release|x64.ActiveCfg = Release|x64 35 | {670B6D36-1AFE-463D-8311-D929C25AF68E}.Release|x64.Build.0 = Release|x64 36 | {D6FF3145-1A10-4739-8E42-C5327BF51584}.Debug|Win32.ActiveCfg = Debug|Win32 37 | {D6FF3145-1A10-4739-8E42-C5327BF51584}.Debug|x64.ActiveCfg = Debug|x64 38 | {D6FF3145-1A10-4739-8E42-C5327BF51584}.Debug|x64.Build.0 = Debug|x64 39 | {D6FF3145-1A10-4739-8E42-C5327BF51584}.Release|Win32.ActiveCfg = Release|Win32 40 | {D6FF3145-1A10-4739-8E42-C5327BF51584}.Release|x64.ActiveCfg = Release|x64 41 | {D6FF3145-1A10-4739-8E42-C5327BF51584}.Release|x64.Build.0 = Release|x64 42 | EndGlobalSection 43 | GlobalSection(SolutionProperties) = preSolution 44 | HideSolutionNode = FALSE 45 | EndGlobalSection 46 | EndGlobal 47 | -------------------------------------------------------------------------------- /FastCopy.vcproj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/laurent22/fastcopy/96b6c6b236a53763c3a011aae78d3be6f8bc3c85/FastCopy.vcproj -------------------------------------------------------------------------------- /FastCopy.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Debug 10 | x64 11 | 12 | 13 | Release 14 | Win32 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | {D6FF3145-1A10-4739-8E42-C5327BF51584} 23 | 24 | 25 | 26 | Application 27 | false 28 | 29 | 30 | Application 31 | false 32 | 33 | 34 | Application 35 | 36 | 37 | Application 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | <_ProjectFileVersion>10.0.40219.1 61 | .\Release\ 62 | .\Release\ 63 | false 64 | .\Debug\ 65 | .\Debug\ 66 | true 67 | 68 | 69 | 70 | NDEBUG;%(PreprocessorDefinitions) 71 | true 72 | true 73 | Win32 74 | .\Release/FastCopy.tlb 75 | 76 | 77 | 78 | 79 | MaxSpeed 80 | OnlyExplicitInline 81 | WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) 82 | true 83 | MultiThreadedDLL 84 | true 85 | .\Release/FastCopy.pch 86 | All 87 | .\Release/ 88 | .\Release/ 89 | .\Release/ 90 | Level3 91 | true 92 | 93 | 94 | NDEBUG;%(PreprocessorDefinitions) 95 | 0x0411 96 | 97 | 98 | comctl32.lib;winmm.lib;%(AdditionalDependencies) 99 | FastCopy.exe 100 | true 101 | .\Release/FastCopy.pdb 102 | true 103 | .\Release/FastCopy.map 104 | Windows 105 | false 106 | 107 | 108 | MachineX86 109 | 110 | 111 | true 112 | .\Release/FastCopy.bsc 113 | 114 | 115 | 116 | 117 | _DEBUG;%(PreprocessorDefinitions) 118 | true 119 | true 120 | Win32 121 | .\Debug/FastCopy.tlb 122 | 123 | 124 | 125 | 126 | Disabled 127 | WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) 128 | true 129 | MultiThreadedDebug 130 | .\Debug/FastCopy.pch 131 | .\Debug/ 132 | .\Debug/ 133 | .\Debug/ 134 | Level3 135 | true 136 | EditAndContinue 137 | 138 | 139 | _DEBUG;%(PreprocessorDefinitions) 140 | 0x0411 141 | 142 | 143 | comctl32.lib;winmm.lib;%(AdditionalDependencies) 144 | .\Debug/FastCopy.exe 145 | true 146 | true 147 | .\Debug/FastCopy.pdb 148 | true 149 | .\Debug/FastCopy.map 150 | Windows 151 | false 152 | 153 | 154 | MachineX86 155 | 156 | 157 | true 158 | .\Debug/FastCopy.bsc 159 | 160 | 161 | 162 | 163 | %(PreprocessorDefinitions) 164 | %(PreprocessorDefinitions) 165 | 166 | 167 | %(PreprocessorDefinitions) 168 | %(PreprocessorDefinitions) 169 | 170 | 171 | %(PreprocessorDefinitions) 172 | %(PreprocessorDefinitions) 173 | 174 | 175 | %(PreprocessorDefinitions) 176 | %(PreprocessorDefinitions) 177 | 178 | 179 | %(PreprocessorDefinitions) 180 | %(PreprocessorDefinitions) 181 | 182 | 183 | %(PreprocessorDefinitions) 184 | %(PreprocessorDefinitions) 185 | 186 | 187 | %(PreprocessorDefinitions) 188 | %(PreprocessorDefinitions) 189 | 190 | 191 | %(PreprocessorDefinitions) 192 | %(PreprocessorDefinitions) 193 | 194 | 195 | %(PreprocessorDefinitions) 196 | %(PreprocessorDefinitions) 197 | 198 | 199 | %(PreprocessorDefinitions) 200 | %(PreprocessorDefinitions) 201 | 202 | 203 | %(PreprocessorDefinitions) 204 | %(PreprocessorDefinitions) 205 | 206 | 207 | %(PreprocessorDefinitions) 208 | %(PreprocessorDefinitions) 209 | 210 | 211 | %(PreprocessorDefinitions) 212 | %(PreprocessorDefinitions) 213 | 214 | 215 | %(PreprocessorDefinitions) 216 | %(PreprocessorDefinitions) 217 | 218 | 219 | %(PreprocessorDefinitions) 220 | %(PreprocessorDefinitions) 221 | 222 | 223 | %(PreprocessorDefinitions) 224 | %(PreprocessorDefinitions) 225 | 226 | 227 | %(PreprocessorDefinitions) 228 | %(PreprocessorDefinitions) 229 | 230 | 231 | 232 | 233 | %(PreprocessorDefinitions) 234 | .\src;src;%(AdditionalIncludeDirectories) 235 | %(PreprocessorDefinitions) 236 | .\src;src;%(AdditionalIncludeDirectories) 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # [FastCopy](https://github.com/laurent22/fastcopy) 2 | *"The Fastest Copy/Delete Software on Windows."* 3 | 4 | ### Info 5 | 6 | This is a Git repository for [FastCopy](http://ipmsg.org/tools/fastcopy.html.en), the copy utility by SHIROUZU Hiroaki. Unfortunately, I was not able to get in touch with the author so I went ahead and created the repository. SHIROUZU Hiroaki, if you read this, please send me an email and I'll make you admin of the project. 7 | 8 | ### License 9 | 10 | According to the official website, all source code has been opened to the public in the BSD license. 11 | 12 | ### Changes 13 | 14 | This version of FastCopy was based on version 2.08 (2011-02-28), with the following new features: 15 | 16 | Version 2.09 (2012-05-19) 17 | 18 | - Support for new Windows 7 taskbar progress bar. 19 | - Removed stdafx dependencies so that code can be compiled with free Visual Studio Express. 20 | - Added "version_in_window_title" INI setting (default = 1) to optionally enable/disable version string in window title. 21 | - Added "minimize_to_tray" INI setting (default = 1) to enable/disable minimizing to system tray. 22 | - Added corresponding "Minimize to system tray" checkbox in config dialog. 23 | 24 | ### Download 25 | 26 | The FastCopy installer and executable can be downloaded from there: 27 | 28 | [Download FastCopy](https://github.com/laurent22/fastcopy/downloads) -------------------------------------------------------------------------------- /help/Index.hhk: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 9 | 10 | -------------------------------------------------------------------------------- /help/email2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/laurent22/fastcopy/96b6c6b236a53763c3a011aae78d3be6f8bc3c85/help/email2.png -------------------------------------------------------------------------------- /help/fastcopy.hhc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/laurent22/fastcopy/96b6c6b236a53763c3a011aae78d3be6f8bc3c85/help/fastcopy.hhc -------------------------------------------------------------------------------- /help/fastcopy.hhk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/laurent22/fastcopy/96b6c6b236a53763c3a011aae78d3be6f8bc3c85/help/fastcopy.hhk -------------------------------------------------------------------------------- /help/fastcopy.hhp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/laurent22/fastcopy/96b6c6b236a53763c3a011aae78d3be6f8bc3c85/help/fastcopy.hhp -------------------------------------------------------------------------------- /help/fastcopy.htm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/laurent22/fastcopy/96b6c6b236a53763c3a011aae78d3be6f8bc3c85/help/fastcopy.htm -------------------------------------------------------------------------------- /install.vcproj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/laurent22/fastcopy/96b6c6b236a53763c3a011aae78d3be6f8bc3c85/install.vcproj -------------------------------------------------------------------------------- /install.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Debug 10 | x64 11 | 12 | 13 | Release 14 | Win32 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | {81F0F7E1-E0A4-4907-9BBD-B13B5B19474A} 23 | install 24 | 25 | 26 | 27 | Application 28 | false 29 | 30 | 31 | Application 32 | false 33 | 34 | 35 | Application 36 | 37 | 38 | Application 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | <_ProjectFileVersion>10.0.40219.1 62 | .\Debug\install\ 63 | .\Debug\install\ 64 | true 65 | .\Release\install\ 66 | .\Release\install\ 67 | false 68 | 69 | 70 | 71 | _DEBUG;%(PreprocessorDefinitions) 72 | true 73 | true 74 | Win32 75 | .\Debug\install/install.tlb 76 | 77 | 78 | 79 | 80 | Disabled 81 | WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) 82 | true 83 | MultiThreadedDebug 84 | .\Debug\install/install.pch 85 | .\Debug\install/ 86 | .\Debug\install/ 87 | .\Debug\install/ 88 | Level3 89 | true 90 | EditAndContinue 91 | 92 | 93 | _DEBUG;%(PreprocessorDefinitions) 94 | 0x0411 95 | 96 | 97 | odbc32.lib;odbccp32.lib;comctl32.lib;winmm.lib;%(AdditionalDependencies) 98 | .\setup.exe 99 | true 100 | true 101 | .\Debug\install/setup.pdb 102 | true 103 | .\Debug\install/setup.map 104 | Windows 105 | false 106 | 107 | 108 | MachineX86 109 | 110 | 111 | true 112 | .\Debug\install/install.bsc 113 | 114 | 115 | 116 | 117 | NDEBUG;%(PreprocessorDefinitions) 118 | true 119 | true 120 | Win32 121 | .\Release\install/install.tlb 122 | 123 | 124 | 125 | 126 | MaxSpeed 127 | OnlyExplicitInline 128 | WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) 129 | true 130 | MultiThreadedDLL 131 | true 132 | .\Release\install/install.pch 133 | All 134 | .\Release\install/ 135 | .\Release\install/ 136 | .\Release\install/ 137 | Level3 138 | true 139 | 140 | 141 | NDEBUG;%(PreprocessorDefinitions) 142 | 0x0411 143 | 144 | 145 | odbc32.lib;odbccp32.lib;comctl32.lib;winmm.lib;%(AdditionalDependencies) 146 | setup.exe 147 | true 148 | .\Release\install/setup.pdb 149 | true 150 | .\Release\install/setup.map 151 | Windows 152 | false 153 | 154 | 155 | MachineX86 156 | 157 | 158 | true 159 | .\Release\install/install.bsc 160 | 161 | 162 | 163 | 164 | %(PreprocessorDefinitions) 165 | %(PreprocessorDefinitions) 166 | 167 | 168 | %(PreprocessorDefinitions) 169 | %(PreprocessorDefinitions) 170 | 171 | 172 | %(PreprocessorDefinitions) 173 | %(PreprocessorDefinitions) 174 | 175 | 176 | %(PreprocessorDefinitions) 177 | %(PreprocessorDefinitions) 178 | 179 | 180 | %(PreprocessorDefinitions) 181 | %(PreprocessorDefinitions) 182 | 183 | 184 | %(PreprocessorDefinitions) 185 | %(PreprocessorDefinitions) 186 | 187 | 188 | %(PreprocessorDefinitions) 189 | %(PreprocessorDefinitions) 190 | 191 | 192 | %(PreprocessorDefinitions) 193 | %(PreprocessorDefinitions) 194 | 195 | 196 | %(PreprocessorDefinitions) 197 | %(PreprocessorDefinitions) 198 | 199 | 200 | %(PreprocessorDefinitions) 201 | %(PreprocessorDefinitions) 202 | 203 | 204 | 205 | 206 | %(PreprocessorDefinitions) 207 | .\src\install;src\install;%(AdditionalIncludeDirectories) 208 | %(PreprocessorDefinitions) 209 | .\src\install;src\install;%(AdditionalIncludeDirectories) 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | -------------------------------------------------------------------------------- /readme.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/laurent22/fastcopy/96b6c6b236a53763c3a011aae78d3be6f8bc3c85/readme.txt -------------------------------------------------------------------------------- /readme_eng.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/laurent22/fastcopy/96b6c6b236a53763c3a011aae78d3be6f8bc3c85/readme_eng.txt -------------------------------------------------------------------------------- /shellex64.vcproj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/laurent22/fastcopy/96b6c6b236a53763c3a011aae78d3be6f8bc3c85/shellex64.vcproj -------------------------------------------------------------------------------- /shellex64.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Debug 10 | x64 11 | 12 | 13 | Release 14 | Win32 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | {670B6D36-1AFE-463D-8311-D929C25AF68E} 23 | 24 | 25 | 26 | DynamicLibrary 27 | false 28 | 29 | 30 | Application 31 | 32 | 33 | Application 34 | 35 | 36 | Application 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | <_ProjectFileVersion>10.0.40219.1 58 | $(SolutionDir)$(Configuration)\ 59 | $(Configuration)\ 60 | .\x64\shellex64\ 61 | .\x64\shellex64\ 62 | false 63 | 64 | 65 | 66 | false 67 | 68 | 69 | 70 | 71 | 72 | 73 | NDEBUG;%(PreprocessorDefinitions) 74 | true 75 | true 76 | Win32 77 | .\x64\shellex64/shellex64.tlb 78 | 79 | 80 | 81 | 82 | MaxSpeed 83 | OnlyExplicitInline 84 | WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) 85 | true 86 | MultiThreaded 87 | true 88 | .\x64\shellex64/shellex64.pch 89 | All 90 | .\x64\shellex64/ 91 | .\x64\shellex64/ 92 | .\x64\shellex64/ 93 | Level3 94 | true 95 | 96 | 97 | NDEBUG;%(PreprocessorDefinitions) 98 | 0x0411 99 | 100 | 101 | odbc32.lib;odbccp32.lib;winmm.lib;%(AdditionalDependencies) 102 | FastEx64.dll 103 | true 104 | .\src\shellext\shell64.def 105 | .\x64\shellex64/FastEx64.pdb 106 | true 107 | .\x64\shellex64/FastEx64.map 108 | Windows 109 | false 110 | 111 | 112 | .\x64\shellex64/FastEx64.lib 113 | MachineX86 114 | 115 | 116 | true 117 | .\x64\shellex64/shellex64.bsc 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | %(PreprocessorDefinitions) 126 | 127 | 128 | %(PreprocessorDefinitions) 129 | 130 | 131 | %(PreprocessorDefinitions) 132 | 133 | 134 | %(PreprocessorDefinitions) 135 | 136 | 137 | %(PreprocessorDefinitions) 138 | 139 | 140 | 141 | 142 | %(PreprocessorDefinitions) 143 | .\src\shellext;src\shellext;%(AdditionalIncludeDirectories) 144 | 145 | 146 | 147 | 148 | 149 | -------------------------------------------------------------------------------- /shellext.vcproj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/laurent22/fastcopy/96b6c6b236a53763c3a011aae78d3be6f8bc3c85/shellext.vcproj -------------------------------------------------------------------------------- /shellext.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Debug 10 | x64 11 | 12 | 13 | Release 14 | Win32 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | {DD8C289F-DDEB-4664-A8CD-65A2B067A1DF} 23 | 24 | 25 | 26 | DynamicLibrary 27 | false 28 | 29 | 30 | Application 31 | 32 | 33 | Application 34 | 35 | 36 | Application 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | <_ProjectFileVersion>10.0.40219.1 58 | $(SolutionDir)$(Configuration)\ 59 | $(Configuration)\ 60 | .\Release\shellext\ 61 | .\Release\shellext\ 62 | false 63 | 64 | 65 | 66 | false 67 | 68 | 69 | 70 | 71 | 72 | 73 | NDEBUG;%(PreprocessorDefinitions) 74 | true 75 | true 76 | Win32 77 | .\Release\shellext/shellext.tlb 78 | 79 | 80 | 81 | 82 | MinSpace 83 | OnlyExplicitInline 84 | WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) 85 | true 86 | MultiThreadedDLL 87 | true 88 | .\release\shellext\shellext3.pch 89 | All 90 | .\Release\shellext/ 91 | .\Release\shellext/ 92 | .\Release\shellext/ 93 | Level3 94 | true 95 | 96 | 97 | NDEBUG;%(PreprocessorDefinitions) 98 | 0x0411 99 | 100 | 101 | odbc32.lib;odbccp32.lib;winmm.lib;%(AdditionalDependencies) 102 | FastExt1.dll 103 | true 104 | .\src\shellext\shellext.def 105 | .\Release\shellext/FastExt1.pdb 106 | true 107 | .\Release\shellext/FastExt1.map 108 | Windows 109 | false 110 | 111 | 112 | .\Release\shellext/FastExt1.lib 113 | MachineX86 114 | 115 | 116 | true 117 | .\Release\shellext/shellext.bsc 118 | 119 | 120 | 121 | 122 | %(PreprocessorDefinitions) 123 | 124 | 125 | %(PreprocessorDefinitions) 126 | 127 | 128 | %(PreprocessorDefinitions) 129 | 130 | 131 | %(PreprocessorDefinitions) 132 | 133 | 134 | %(PreprocessorDefinitions) 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | %(PreprocessorDefinitions) 143 | .\src\shellext;src\shellext;%(AdditionalIncludeDirectories) 144 | 145 | 146 | 147 | 148 | 149 | -------------------------------------------------------------------------------- /src/cfg.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/laurent22/fastcopy/96b6c6b236a53763c3a011aae78d3be6f8bc3c85/src/cfg.cpp -------------------------------------------------------------------------------- /src/cfg.h: -------------------------------------------------------------------------------- 1 | /* static char *cfg_id = 2 | "@(#)Copyright (C) 2005-2010 H.Shirouzu cfg.h Ver2.04"; */ 3 | /* ======================================================================== 4 | Project Name : Fast/Force copy file and directory 5 | Create : 2005-01-23(Sun) 6 | Update : 2010-11-07(Sun) 7 | Copyright : H.Shirouzu 8 | Reference : 9 | ======================================================================== */ 10 | 11 | #ifndef CFG_H 12 | #define CFG_H 13 | #include "tlib/tlib.h" 14 | #include "resource.h" 15 | 16 | struct Job { 17 | void *title; 18 | void *src; 19 | void *dst; 20 | void *cmd; 21 | int bufSize; 22 | int estimateMode; 23 | int diskMode; 24 | BOOL ignoreErr; 25 | BOOL enableOwdel; 26 | BOOL enableAcl; 27 | BOOL enableStream; 28 | BOOL enableVerify; 29 | BOOL isFilter; 30 | void *includeFilter; 31 | void *excludeFilter; 32 | void *fromDateFilter; 33 | void *toDateFilter; 34 | void *minSizeFilter; 35 | void *maxSizeFilter; 36 | 37 | void Init() { 38 | memset(this, 0, sizeof(Job)); 39 | } 40 | void SetString(void *_title, void *_src, void *_dst, void *_cmd, 41 | void *_includeFilter, void *_excludeFilter, 42 | void *_fromDateFilter, void *_toDateFilter, 43 | void *_minSizeFilter, void *_maxSizeFilter) { 44 | title = strdupV(_title); 45 | src = strdupV(_src); 46 | dst = strdupV(_dst); 47 | cmd = strdupV(_cmd); 48 | includeFilter = strdupV(_includeFilter); 49 | excludeFilter = strdupV(_excludeFilter); 50 | fromDateFilter = strdupV(_fromDateFilter); 51 | toDateFilter = strdupV(_toDateFilter); 52 | minSizeFilter = strdupV(_minSizeFilter); 53 | maxSizeFilter = strdupV(_maxSizeFilter); 54 | } 55 | void Set(const Job *job) { 56 | memcpy(this, job, sizeof(Job)); 57 | SetString(job->title, job->src, job->dst, job->cmd, 58 | job->includeFilter, job->excludeFilter, 59 | job->fromDateFilter, job->toDateFilter, 60 | job->minSizeFilter, job->maxSizeFilter); 61 | } 62 | void UnSet() { 63 | free(excludeFilter); 64 | free(includeFilter); 65 | free(fromDateFilter); 66 | free(toDateFilter); 67 | free(minSizeFilter); 68 | free(maxSizeFilter); 69 | free(cmd); 70 | free(dst); 71 | free(src); 72 | free(title); 73 | Init(); 74 | } 75 | 76 | Job() { 77 | Init(); 78 | } 79 | Job(const Job& job) { 80 | Init(); 81 | Set(&job); 82 | } 83 | ~Job() { UnSet(); } 84 | }; 85 | 86 | struct FinAct { 87 | void *title; 88 | void *sound; 89 | void *command; 90 | int shutdownTime; 91 | DWORD flags; 92 | enum { BUILTIN=0x1, ERR_SOUND=0x2, ERR_CMD=0x4, ERR_SHUTDOWN=0x8, WAIT_CMD=0x10, 93 | FORCE=0x20, SUSPEND=0x40, HIBERNATE=0x80, SHUTDOWN=0x100 }; 94 | 95 | void Init() { 96 | memset(this, 0, sizeof(FinAct)); 97 | shutdownTime = -1; 98 | } 99 | void SetString(void *_title, void *_sound, void *_command) { 100 | title = strdupV(_title); 101 | sound = strdupV(_sound); 102 | command = strdupV(_command); 103 | } 104 | void Set(const FinAct *finAct) { 105 | memcpy(this, finAct, sizeof(FinAct)); 106 | SetString(finAct->title, finAct->sound, finAct->command); 107 | } 108 | void UnSet() { 109 | free(command); 110 | free(sound); 111 | free(title); 112 | Init(); 113 | } 114 | FinAct() { 115 | Init(); 116 | } 117 | FinAct(const FinAct& action) { 118 | Init(); 119 | Set(&action); 120 | } 121 | ~FinAct() { UnSet(); } 122 | }; 123 | 124 | class Cfg { 125 | protected: 126 | TInifile ini; 127 | BOOL Init(void *user_dir, void *virtual_dir); 128 | BOOL IniStrToV(char *inipath, void *path); 129 | BOOL VtoIniStr(void *path, char *inipath); 130 | BOOL EntryHistory(void **path_array, void ****history_array, int max); 131 | 132 | public: 133 | int bufSize; 134 | int maxTransSize; 135 | int maxOpenFiles; 136 | int maxAttrSize; 137 | int maxDirSize; 138 | int nbMinSizeNtfs; 139 | int nbMinSizeFat; 140 | BOOL isReadOsBuf; 141 | int maxHistory; 142 | int maxHistoryNext; 143 | int copyMode; 144 | int copyFlags; 145 | int skipEmptyDir; // 0:no, 1:filter-mode only, 2:always 146 | int forceStart; // 0:delete only, 1:always(copy+delete), 2:always wait 147 | BOOL ignoreErr; 148 | int estimateMode; 149 | int diskMode; 150 | int lcid; 151 | int waitTick; 152 | int speedLevel; 153 | BOOL isAutoSlowIo; 154 | BOOL alwaysLowIo; 155 | BOOL enableOwdel; 156 | BOOL enableAcl; 157 | BOOL enableStream; 158 | BOOL enableVerify; 159 | BOOL usingMD5; 160 | BOOL enableNSA; 161 | BOOL delDirWithFilter; 162 | BOOL enableMoveAttr; 163 | BOOL serialMove; 164 | BOOL serialVerifyMove; 165 | BOOL isReparse; 166 | BOOL isLinkDest; 167 | int maxLinkHash; 168 | _int64 allowContFsize; 169 | BOOL isReCreate; 170 | BOOL isExtendFilter; 171 | BOOL isTopLevel; 172 | BOOL isErrLog; 173 | BOOL isUtf8Log; 174 | int fileLogMode; 175 | BOOL aclErrLog; 176 | BOOL streamErrLog; 177 | BOOL isRunasButton; 178 | BOOL isSameDirRename; 179 | BOOL shextAutoClose; 180 | BOOL shextTaskTray; 181 | BOOL shextNoConfirm; 182 | BOOL shextNoConfirmDel; 183 | BOOL execConfirm; 184 | BOOL isVersionInWindowTitle; 185 | BOOL isMinimizeToTray; 186 | void **srcPathHistory; 187 | void **dstPathHistory; 188 | void **delPathHistory; 189 | void **includeHistory; 190 | void **excludeHistory; 191 | void **fromDateHistory; 192 | void **toDateHistory; 193 | void **minSizeHistory; 194 | void **maxSizeHistory; 195 | void *execPathV; 196 | void *execDirV; 197 | void *userDirV; 198 | void *virtualDirV; 199 | void *errLogPathV; // UNICODE 200 | Job **jobArray; 201 | int jobMax; 202 | FinAct **finActArray; 203 | int finActMax; 204 | POINT winpos; 205 | SIZE winsize; 206 | char driveMap[64]; 207 | 208 | Cfg(); 209 | ~Cfg(); 210 | BOOL ReadIni(void *user_dir, void *virtual_dir); 211 | BOOL PostReadIni(void); 212 | BOOL WriteIni(void); 213 | BOOL EntryPathHistory(void *src, void *dst); 214 | BOOL EntryDelPathHistory(void *del); 215 | BOOL EntryFilterHistory(void *inc, void *exc, void *from, void *to, void *min, void *max); 216 | 217 | int SearchJobV(void *title); 218 | BOOL AddJobV(const Job *job); 219 | BOOL DelJobV(void *title); 220 | 221 | int SearchFinActV(void *title, BOOL cmd_line=FALSE); 222 | BOOL AddFinActV(const FinAct *job); 223 | BOOL DelFinActV(void *title); 224 | }; 225 | 226 | #define INVALID_POINTVAL -10000 227 | #define INVALID_SIZEVAL -10000 228 | 229 | #define IS_INVALID_POINT(pt) (pt.x == INVALID_POINTVAL && pt.y == INVALID_POINTVAL) 230 | #define IS_INVALID_SIZE(sz) (sz.cx == INVALID_SIZEVAL && sz.cy == INVALID_SIZEVAL) 231 | 232 | 233 | #endif 234 | -------------------------------------------------------------------------------- /src/fastcopy.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/laurent22/fastcopy/96b6c6b236a53763c3a011aae78d3be6f8bc3c85/src/fastcopy.cpp -------------------------------------------------------------------------------- /src/fastcopy.exe.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | FastCopy http://ipmsg.org/tools/fastcopy.html 10 | 11 | 12 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /src/fastcopy.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/laurent22/fastcopy/96b6c6b236a53763c3a011aae78d3be6f8bc3c85/src/fastcopy.h -------------------------------------------------------------------------------- /src/fastcopy.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/laurent22/fastcopy/96b6c6b236a53763c3a011aae78d3be6f8bc3c85/src/fastcopy.ico -------------------------------------------------------------------------------- /src/fastcopy.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/laurent22/fastcopy/96b6c6b236a53763c3a011aae78d3be6f8bc3c85/src/fastcopy.rc -------------------------------------------------------------------------------- /src/fastcopy2.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/laurent22/fastcopy/96b6c6b236a53763c3a011aae78d3be6f8bc3c85/src/fastcopy2.ico -------------------------------------------------------------------------------- /src/fastcopy3.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/laurent22/fastcopy/96b6c6b236a53763c3a011aae78d3be6f8bc3c85/src/fastcopy3.ico -------------------------------------------------------------------------------- /src/fastcopy4.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/laurent22/fastcopy/96b6c6b236a53763c3a011aae78d3be6f8bc3c85/src/fastcopy4.ico -------------------------------------------------------------------------------- /src/fcwait.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/laurent22/fastcopy/96b6c6b236a53763c3a011aae78d3be6f8bc3c85/src/fcwait.ico -------------------------------------------------------------------------------- /src/install/install.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/laurent22/fastcopy/96b6c6b236a53763c3a011aae78d3be6f8bc3c85/src/install/install.cpp -------------------------------------------------------------------------------- /src/install/install.h: -------------------------------------------------------------------------------- 1 | /* @(#)Copyright (C) 2005-2010 H.Shirouzu install.h Ver2.00 */ 2 | /* ======================================================================== 3 | Project Name : Installer for IPMSG32 4 | Module Name : Main Header 5 | Create : 2005-02-02(Wed) 6 | Update : 2010-05-09(Sun) 7 | Copyright : H.Shirouzu 8 | Reference : 9 | ======================================================================== */ 10 | 11 | enum InstMode { SETUP_MODE, UNINSTALL_MODE }; 12 | 13 | struct InstallCfg { 14 | InstMode mode; 15 | BOOL programLink; 16 | BOOL desktopLink; 17 | BOOL runImme; 18 | HWND hOrgWnd; 19 | WCHAR *setupDir; 20 | WCHAR *appData; 21 | WCHAR *virtualDir; 22 | void *startMenu; 23 | void *deskTop; 24 | }; 25 | 26 | class TInstSheet : public TDlg 27 | { 28 | InstallCfg *cfg; 29 | 30 | public: 31 | TInstSheet(TWin *_parent, InstallCfg *_cfg); 32 | 33 | virtual BOOL EvCreate(LPARAM lParam); 34 | virtual BOOL EvCommand(WORD wNotifyCode, WORD wID, LPARAM hwndCtl); 35 | 36 | void Paste(void); 37 | void GetData(void); 38 | void PutData(void); 39 | }; 40 | 41 | class TInstDlg : public TDlg 42 | { 43 | protected: 44 | TSubClassCtl staticText; 45 | TInstSheet *propertySheet; 46 | InstallCfg cfg; 47 | 48 | public: 49 | TInstDlg(char *cmdLine); 50 | virtual ~TInstDlg(); 51 | 52 | virtual BOOL EvCreate(LPARAM lParam); 53 | virtual BOOL EvCommand(WORD wNotifyCode, WORD wID, LPARAM hwndCtl); 54 | #if 0 55 | virtual BOOL EvNcDestroy(void); 56 | virtual BOOL EventUser(UINT uMsg, WPARAM wParam, LPARAM lParam); 57 | #endif 58 | BOOL Install(void); 59 | BOOL UnInstall(void); 60 | BOOL RunAsAdmin(BOOL is_imme); 61 | void ChangeMode(void); 62 | BOOL RemoveSameLink(const char *dir, char *remove_path=NULL); 63 | }; 64 | 65 | class TInstApp : public TApp 66 | { 67 | public: 68 | TInstApp(HINSTANCE _hI, LPSTR _cmdLine, int _nCmdShow); 69 | virtual ~TInstApp(); 70 | 71 | void InitWindow(void); 72 | }; 73 | 74 | class TBrowseDirDlg : public TSubClass 75 | { 76 | protected: 77 | char *fileBuf; 78 | BOOL dirtyFlg; 79 | 80 | public: 81 | TBrowseDirDlg(char *_fileBuf) { fileBuf = _fileBuf; } 82 | virtual BOOL AttachWnd(HWND _hWnd); 83 | virtual BOOL EvCommand(WORD wNotifyCode, WORD wID, LPARAM hwndCtl); 84 | virtual BOOL SetFileBuf(LPARAM list); 85 | BOOL IsDirty(void) { return dirtyFlg; }; 86 | }; 87 | 88 | class TInputDlg : public TDlg 89 | { 90 | protected: 91 | char *dirBuf; 92 | 93 | public: 94 | TInputDlg(char *_dirBuf, TWin *_win) : TDlg(INPUT_DIALOG, _win) { dirBuf = _dirBuf; } 95 | virtual BOOL EvCommand(WORD wNotifyCode, WORD wID, LPARAM hwndCtl); 96 | }; 97 | 98 | #define FASTCOPY "FastCopy" 99 | #define FASTCOPY_EXE "FastCopy.exe" 100 | #define INSTALL_EXE "setup.exe" 101 | #define README_TXT "readme.txt" 102 | #define HELP_CHM "FastCopy.chm" 103 | #define SHELLEXT1_DLL "FastCopy_shext.dll" 104 | #define SHELLEXT2_DLL "FastCopy_shext2.dll" 105 | #define SHELLEXT3_DLL "FastCopy_shext3.dll" 106 | #define SHELLEXT4_DLL "FastCopy_shext4.dll" 107 | #define FCSHELLEXT1_DLL "FastExt1.dll" 108 | #define FCSHELLEX64_DLL "FastEx64.dll" 109 | 110 | #ifdef _WIN64 111 | #define CURRENT_SHEXTDLL FCSHELLEX64_DLL 112 | #define CURRENT_SHEXTDLL_EX FCSHELLEXT1_DLL 113 | #else 114 | #define CURRENT_SHEXTDLL FCSHELLEXT1_DLL 115 | #define CURRENT_SHEXTDLL_EX FCSHELLEX64_DLL 116 | #endif 117 | 118 | #define UNC_PREFIX "\\\\" 119 | 120 | #define UNINSTALL_CMDLINE "/r" 121 | #define FASTCOPY_SHORTCUT "FastCopy.lnk" 122 | 123 | #define REGSTR_SHELLFOLDERS REGSTR_PATH_EXPLORER "\\Shell Folders" 124 | #define REGSTR_STARTUP "Startup" 125 | #define REGSTR_DESKTOP "Desktop" 126 | #define REGSTR_PROGRAMS "Programs" 127 | #define REGSTR_PATH "Path" 128 | #define REGSTR_PROGRAMFILES "ProgramFilesDir" 129 | 130 | #define INSTALL_STR "Install" 131 | #define UNINSTALL_STR "UnInstall" 132 | 133 | // function prototype 134 | int strncmpi(const char *str1, const char *str2, int num); 135 | void BrowseDirDlg(TWin *parentWin, UINT editCtl, char *title); 136 | int CALLBACK BrowseDirDlg_Proc(HWND hWnd, UINT uMsg, LPARAM lParam, LPARAM data); 137 | int MakePath(char *dest, const char *dir, const char *file); 138 | UINT GetDriveTypeEx(const char *file); 139 | 140 | // inline function 141 | inline BOOL IsUncFile(const char *path) { return strnicmp(path, UNC_PREFIX, 2) == 0; } 142 | 143 | -------------------------------------------------------------------------------- /src/install/install.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/laurent22/fastcopy/96b6c6b236a53763c3a011aae78d3be6f8bc3c85/src/install/install.rc -------------------------------------------------------------------------------- /src/install/instrc.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Developer Studio generated include file. 3 | // Used by install.rc 4 | // 5 | #define IDC_STATIC -1 6 | #define IDS_MKDIR 1 7 | #define IDS_RMDIR 2 8 | #define IDS_SETUPCOMPLETE 3 9 | #define IDS_UNINSTFIN 4 10 | #define IDS_UNINSTSHEXTFIN 5 11 | #define IDS_NOTCREATEDIR 6 12 | #define IDS_NOTCREATEFILE 7 13 | #define IDS_START 8 14 | #define IDS_DELAYSETUPCOMPLETE 9 15 | #define IDS_ADMINCHANGE 10 16 | #define INSTALL_SHEET 101 17 | #define SETUP_ICON 104 18 | #define MKDIR_BUTTON 110 19 | #define RMDIR_BUTTON 111 20 | #define INSTALL_DIALOG 149 21 | #define INPUT_DIALOG 150 22 | #define UNINSTALL_SHEET 151 23 | #define INSTALL_STATIC 1133 24 | #define FILE_EDIT 1135 25 | #define FILE_BUTTON 1136 26 | #define DESKTOP_CHECK 1138 27 | #define PROGRAM_CHECK 1139 28 | #define INPUT_EDIT 1139 29 | #define SETUP_RADIO 1143 30 | #define UNINSTALL_RADIO 1147 31 | 32 | // Next default values for new objects 33 | // 34 | #ifdef APSTUDIO_INVOKED 35 | #ifndef APSTUDIO_READONLY_SYMBOLS 36 | #define _APS_NO_MFC 1 37 | #define _APS_3D_CONTROLS 1 38 | #define _APS_NEXT_RESOURCE_VALUE 153 39 | #define _APS_NEXT_COMMAND_VALUE 30034 40 | #define _APS_NEXT_CONTROL_VALUE 1155 41 | #define _APS_NEXT_SYMED_VALUE 112 42 | #endif 43 | #endif 44 | -------------------------------------------------------------------------------- /src/install/setup.exe.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | FastCopy setup http://ipmsg.org/tools/fastcopy.html 10 | 11 | 12 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /src/install/setup.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/laurent22/fastcopy/96b6c6b236a53763c3a011aae78d3be6f8bc3c85/src/install/setup.ico -------------------------------------------------------------------------------- /src/mainwin.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/laurent22/fastcopy/96b6c6b236a53763c3a011aae78d3be6f8bc3c85/src/mainwin.cpp -------------------------------------------------------------------------------- /src/mainwin.h: -------------------------------------------------------------------------------- 1 | /* static char *fastcopy_id = 2 | "@(#)Copyright (C) 2004-2010 H.Shirouzu mainwin.h Ver2.00"; */ 3 | /* ======================================================================== 4 | Project Name : Fast Copy file and directory 5 | Create : 2004-09-15(Wed) 6 | Update : 2010-05-09(Sun) 7 | Copyright : H.Shirouzu 8 | Reference : 9 | ======================================================================== */ 10 | 11 | #ifndef MAINWIN_H 12 | #define MAINWIN_H 13 | 14 | #pragma warning(disable:4355) 15 | 16 | #include "tlib/tlib.h" 17 | #include "fastcopy.h" 18 | #include "cfg.h" 19 | #include "miscdlg.h" 20 | #include "version.h" 21 | #include 22 | 23 | // Required for ITaskbarList3 24 | #include "ShObjIdl.h" 25 | 26 | #ifdef _WIN64 27 | #define FASTCOPY_TITLE "FastCopy(64bit)" 28 | #else 29 | #define FASTCOPY_TITLE "FastCopy" 30 | #endif 31 | #define FASTCOPY_CLASS "fastcopy_class" 32 | 33 | #define WM_FASTCOPY_MSG (WM_USER + 100) 34 | #define WM_FASTCOPY_NOTIFY (WM_USER + 101) 35 | #define WM_FASTCOPY_HIDDEN (WM_USER + 102) 36 | #define WM_FASTCOPY_RUNAS (WM_USER + 103) 37 | #define WM_FASTCOPY_STATUS (WM_USER + 104) 38 | #define WM_FASTCOPY_KEY (WM_USER + 105) 39 | #define WM_FASTCOPY_PATHHISTCLEAR (WM_USER + 106) 40 | #define WM_FASTCOPY_FILTERHISTCLEAR (WM_USER + 107) 41 | 42 | #define FASTCOPY_TIMER 100 43 | #define FASTCOPY_NIM_ID 100 44 | #define FASTCOPY_FIN_TIMER 110 45 | 46 | #define FASTCOPYLOG_MUTEX "FastCopyLogMutex" 47 | 48 | #define MAX_HISTORY_BUF 8192 49 | #define MAX_HISTORY_CHAR_BUF (MAX_HISTORY_BUF * 4) 50 | 51 | #define MINI_BUF 128 52 | 53 | #define SHELLEXT_MIN_ALLOC (16 * 1024) 54 | #define SHELLEXT_MAX_ALLOC (4 * 1024 * 1024) 55 | 56 | struct CopyInfo { 57 | UINT resId; 58 | char *list_str; 59 | UINT cmdline_resId; 60 | void *cmdline_name; 61 | FastCopy::Mode mode; 62 | FastCopy::OverWrite overWrite; 63 | }; 64 | 65 | struct TaskbarProgressBarState { 66 | TBPFLAG tbpFlags; 67 | ULONGLONG ullCompleted; 68 | ULONGLONG ullTotal; 69 | }; 70 | 71 | #define MAX_NORMAL_FASTCOPY_ICON 4 72 | #define FCNORMAL_ICON_INDEX 0 73 | #define FCWAIT_ICON_INDEX MAX_NORMAL_FASTCOPY_ICON 74 | #define MAX_FASTCOPY_ICON MAX_NORMAL_FASTCOPY_ICON + 1 75 | 76 | #define SPEED_FULL 11 77 | #define SPEED_AUTO 10 78 | #define SPEED_SUSPEND 0 79 | 80 | class TMainDlg : public TDlg { 81 | protected: 82 | enum AutoCloseLevel { NO_CLOSE, NOERR_CLOSE, FORCE_CLOSE }; 83 | enum { NORMAL_EXEC=1, LISTING_EXEC=2, CMDLINE_EXEC=4 }; 84 | enum { RUNAS_IMMEDIATE=1, RUNAS_SHELLEXT=2, RUNAS_AUTOCLOSE=4 }; 85 | enum { READ_LVIDX, WRITE_LVIDX, VERIFY_LVIDX, SKIP_LVIDX, DEL_LVIDX, OVWR_LVIDX }; 86 | enum FileLogMode { NO_FILELOG, AUTO_FILELOG, FIX_FILELOG }; 87 | 88 | FastCopy fastCopy; 89 | FastCopy::Info info; 90 | 91 | int orgArgc; 92 | void **orgArgv; 93 | Cfg cfg; 94 | HICON hMainIcon[MAX_FASTCOPY_ICON]; 95 | CopyInfo *copyInfo; 96 | int finActIdx; 97 | int doneRatePercent; 98 | int lastTotalSec; 99 | int calcTimes; 100 | BOOL isAbort; 101 | 102 | /* Taskbar progress bar properties */ 103 | ITaskbarList3* taskbarInterface; 104 | // We keep a reference to the progress bar state for optimization purposes 105 | // i.e. we don't call SetProgressState/SetProgressValue if the state hasn't changed 106 | TaskbarProgressBarState taskbarProgressBarState; 107 | /* End of Taskbar progress bar properties */ 108 | 109 | /* share to runas */ 110 | AutoCloseLevel autoCloseLevel; 111 | BOOL isTaskTray; 112 | BOOL speedLevel; 113 | 114 | BOOL noConfirmDel; 115 | BOOL noConfirmStop; 116 | UINT diskMode; 117 | BOOL isRegExp; 118 | BOOL isShellExt; 119 | BOOL isNetPlaceSrc; 120 | int skipEmptyDir; 121 | int forceStart; 122 | WCHAR errLogPathV[MAX_PATH]; 123 | WCHAR fileLogPathV[MAX_PATH]; 124 | BOOL isErrLog; 125 | BOOL isUtf8Log; 126 | FileLogMode fileLogMode; 127 | BOOL isReparse; 128 | BOOL isLinkDest; 129 | int maxLinkHash; 130 | BOOL isReCreate; 131 | BOOL isExtendFilter; 132 | BOOL resultStatus; 133 | 134 | BOOL shextNoConfirm; 135 | BOOL shextNoConfirmDel; 136 | BOOL shextTaskTray; 137 | BOOL shextAutoClose; 138 | 139 | /* end of share to runas */ 140 | 141 | BOOL isRunAsStart; 142 | BOOL isRunAsParent; 143 | 144 | void *RunasShareData() { return (void*)&autoCloseLevel; } 145 | DWORD RunasShareSize() { 146 | return offsetof(TMainDlg, isRunAsStart) - offsetof(TMainDlg, autoCloseLevel); 147 | } 148 | 149 | enum { srcbutton_item=0, dstbutton_item, srccombo_item, dstcombo_item, 150 | status_item, mode_item, bufstatic_item, bufedit_item, help_item, 151 | ignore_item, estimate_item, verify_item, top_item, list_item, ok_item, atonce_item, 152 | owdel_item, acl_item, stream_item, speed_item, speedstatic_item, samedrv_item, 153 | incstatic_item, excstatic_item, inccombo_item, exccombo_item, filter_item, 154 | // fromdate_static, todate_static, minsize_static, maxsize_static, 155 | // fromdate_combo, todate_combo, minsize_combo, maxsize_combo, 156 | path_item, errstatic_item, errstatus_item, erredit_item, max_dlgitem }; 157 | 158 | int listBufOffset; 159 | int errBufOffset; 160 | UINT TaskBarCreateMsg; 161 | int miniHeight; 162 | int normalHeight; 163 | int filterHeight; 164 | BOOL isErrEditHide; 165 | UINT curIconIndex; 166 | BOOL isDelay; 167 | 168 | UINT timerID; 169 | SYSTEMTIME startTm; 170 | DWORD endTick; 171 | 172 | char *pathLogBuf; 173 | HANDLE hErrLog; 174 | HANDLE hErrLogMutex; 175 | HANDLE hFileLog; 176 | TransInfo ti; 177 | 178 | // for detect autoslow status 179 | DWORD timerCnt; 180 | POINT curPt; 181 | HWND curForeWnd; 182 | DWORD curPriority; 183 | 184 | #ifdef USE_LISTVIEW 185 | // TListHeader listHead; 186 | // TListViewEx listView; 187 | #endif 188 | 189 | TAboutDlg aboutDlg; 190 | TSetupDlg setupDlg; 191 | TShellExtDlg shellExtDlg; 192 | TJobDlg jobDlg; 193 | TFinActDlg finActDlg; 194 | TEditSub pathEdit; 195 | TEditSub errEdit; 196 | 197 | protected: 198 | BOOL SetCopyModeList(void); 199 | BOOL IsForeground(); 200 | BOOL MoveCenter(BOOL isShow); 201 | BOOL SetupWindow(); 202 | BOOL ExecCopy(DWORD exec_flags); 203 | BOOL ExecCopyCore(void); 204 | BOOL EndCopy(void); 205 | BOOL ExecFinalAction(BOOL is_sound_wait); 206 | BOOL CancelCopy(void); 207 | void SetItemEnable(BOOL is_delete); 208 | FastCopy::Mode GetCopyMode(void); 209 | void SetExtendFilter(); 210 | void ReflectFilterCheck(BOOL is_invert=FALSE); 211 | BOOL SwapTarget(BOOL check_only=FALSE); 212 | BOOL SwapTargetCore(const void *s, const void *d, void *out_s, void *out_d); 213 | void SetSize(void); 214 | void UpdateMenu(); 215 | void SetJob(int idx); 216 | BOOL IsListing() { return (info.flags & FastCopy::LISTING_ONLY) ? TRUE : FALSE; } 217 | void SetPriority(DWORD new_class); 218 | DWORD UpdateSpeedLevel(BOOL is_timer=FALSE); 219 | #ifdef USE_LISTVIEW 220 | int ListViewIdx(int idx); 221 | BOOL SetListViewItem(int idx, int subIdx, char *txt); 222 | #endif 223 | void SetListInfo(); 224 | void SetFileLogInfo(); 225 | BOOL SetTaskTrayInfo(BOOL is_finish_status, double doneRate, int remain_h, int remain_m, 226 | int remain_s); 227 | BOOL CalcInfo(double *doneRate, int *remain_sec, int *total_sec); 228 | void WriteLogHeader(HANDLE hFile, BOOL add_filelog=TRUE); 229 | BOOL WriteLogFooter(HANDLE hFile); 230 | BOOL WriteErrLog(BOOL is_initerr=FALSE); 231 | BOOL CheckVerifyExtension(); 232 | BOOL StartFileLog(); 233 | void EndFileLog(); 234 | void SetTaskbarProgressState(TBPFLAG tbpFlags); 235 | void SetTaskbarProgressValue(ULONGLONG ullCompleted, ULONGLONG ullTotal); 236 | 237 | public: 238 | TMainDlg(); 239 | virtual ~TMainDlg(); 240 | 241 | virtual BOOL EvCreate(LPARAM lParam); 242 | virtual BOOL EvTaskbarButtonCreated(); 243 | virtual BOOL EvCommand(WORD wNotifyCode, WORD wID, LPARAM hwndCtl); 244 | virtual BOOL EvNcDestroy(void); 245 | virtual BOOL EvTimer(WPARAM timerID, TIMERPROC proc); 246 | virtual BOOL EvSysCommand(WPARAM uCmdType, POINTS pos); 247 | virtual BOOL EvSize(UINT fwSizeType, WORD nWidth, WORD nHeight); 248 | virtual BOOL EvDropFiles(HDROP hDrop); 249 | virtual BOOL EventScroll(UINT uMsg, int nCode, int nPos, HWND scrollBar); 250 | /* 251 | virtual BOOL EvEndSession(BOOL nSession, BOOL nLogOut); 252 | virtual BOOL EvQueryOpen(void); 253 | virtual BOOL EvHotKey(int hotKey); 254 | virtual BOOL EventButton(UINT uMsg, int nHitTest, POINTS pos); 255 | */ 256 | virtual BOOL EventInitMenu(UINT uMsg, HMENU hMenu, UINT uPos, BOOL fSystemMenu); 257 | virtual BOOL EventActivateApp(BOOL fActivate, DWORD dwThreadID); 258 | virtual BOOL EventUser(UINT uMsg, WPARAM wParam, LPARAM lParam); 259 | virtual BOOL EventSystem(UINT uMsg, WPARAM wParam, LPARAM lParam); 260 | virtual void Show(int mode = SW_SHOWDEFAULT); 261 | 262 | BOOL RunAsAdmin(DWORD flg = 0); 263 | BOOL EnableErrLogFile(BOOL on); 264 | int CmdNameToComboIndex(void *cmd_name); 265 | 266 | BOOL GetRunasInfo(WCHAR **user_dir, WCHAR **virtual_dir); 267 | BOOL CommandLineExecV(int argc, void **argv); 268 | BOOL RunasSync(HWND hOrg); 269 | 270 | BOOL SetMiniWindow(void); 271 | BOOL SetNormalWindow(void); 272 | void RefreshWindow(BOOL is_start_stop=FALSE); 273 | BOOL SetWindowTitle(); 274 | BOOL IsDestDropFiles(HDROP hDrop); 275 | _int64 GetDateInfo(void *buf, BOOL is_end); 276 | _int64 GetSizeInfo(void *buf); 277 | BOOL SetInfo(BOOL is_task_tray=FALSE, BOOL is_finish_status=FALSE); 278 | enum SetHistMode { SETHIST_LIST, SETHIST_EDIT, SETHIST_CLEAR }; 279 | void SetComboBox(UINT item, void **history, SetHistMode mode); 280 | void SetPathHistory(SetHistMode mode, UINT item=0); 281 | void SetFilterHistory(SetHistMode mode, UINT item=0); 282 | BOOL TaskTray(int nimMode, HICON hSetIcon=NULL, LPCSTR tip=NULL); 283 | CopyInfo *GetCopyInfo() { return copyInfo; } 284 | void SetFinAct(int idx); 285 | int GetFinActIdx() { return finActIdx; } 286 | 287 | }; 288 | 289 | class TFastCopyApp : public TApp { 290 | public: 291 | TFastCopyApp(HINSTANCE _hI, LPSTR _cmdLine, int _nCmdShow); 292 | virtual ~TFastCopyApp(); 293 | 294 | virtual void InitWindow(void); 295 | virtual BOOL PreProcMsg(MSG *msg); 296 | }; 297 | 298 | #endif 299 | 300 | -------------------------------------------------------------------------------- /src/miscdlg.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/laurent22/fastcopy/96b6c6b236a53763c3a011aae78d3be6f8bc3c85/src/miscdlg.cpp -------------------------------------------------------------------------------- /src/miscdlg.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/laurent22/fastcopy/96b6c6b236a53763c3a011aae78d3be6f8bc3c85/src/miscdlg.h -------------------------------------------------------------------------------- /src/regexp.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/laurent22/fastcopy/96b6c6b236a53763c3a011aae78d3be6f8bc3c85/src/regexp.cpp -------------------------------------------------------------------------------- /src/regexp.h: -------------------------------------------------------------------------------- 1 | /* @(#)Copyright (C) 2005-2006 H.Shirouzu regexp.cpp ver1.84 */ 2 | /* ======================================================================== 3 | Project Name : Regular Expression / Wild Card Match Library 4 | Create : 2005-11-03(The) 5 | Update : 2006-01-31(Tue) 6 | Reference : 7 | ======================================================================== */ 8 | 9 | typedef unsigned _int64 RegStates; 10 | 11 | class RegExp { 12 | public: 13 | RegExp(); 14 | ~RegExp(); 15 | 16 | enum CaseSense { CASE_SENSE, CASE_INSENSE }; 17 | 18 | void Init(); 19 | BOOL RegisterWildCard(const void *wild_str, CaseSense cs=CASE_SENSE); 20 | // BOOL RegisterRegStr(const void *reg_str, CaseSense cs=CASE_SENSE); 21 | BOOL IsMatch(const void *target); 22 | BOOL IsRegistered(void) { return max_state ? TRUE : FALSE; } 23 | 24 | protected: 25 | enum StatesType { NORMAL_TBL, REV_TBL, MAX_STATES_TBL }; 26 | RegStates **states_tbl[MAX_STATES_TBL]; 27 | RegStates (*epsilon_tbl)[BYTE_NUM]; 28 | RegStates end_states; 29 | int max_state; 30 | 31 | void AddRegStates(StatesType type, WCHAR ch, const RegStates &state_pattern); 32 | RegStates GetRegStates(StatesType type, WCHAR ch); 33 | void AddEpStates(int state, const RegStates &add_states); 34 | RegStates GetEpStates(RegStates cur_states); 35 | inline void AddRegStatesEx(StatesType type, WCHAR ch, CaseSense cs); 36 | }; 37 | 38 | class RegExpEx { 39 | public: 40 | RegExpEx() { 41 | RegArray = NULL; 42 | RegArrayNum = 0; 43 | } 44 | void Init() { 45 | while (RegArrayNum > 0) { 46 | delete RegArray[--RegArrayNum]; 47 | } 48 | free(RegArray); 49 | RegArray = NULL; 50 | } 51 | BOOL RegisterWildCard(const void *wild_str, RegExp::CaseSense cs=RegExp::CASE_SENSE) { 52 | int i; 53 | for (i=0; i < RegArrayNum; i++) { 54 | if (RegArray[i]->RegisterWildCard(wild_str, cs)) return TRUE; 55 | if (!RegArray[i]->IsRegistered()) return FALSE; 56 | } 57 | RegArray = (RegExp **)realloc(RegArray, sizeof(RegExp *) * ++RegArrayNum); 58 | RegArray[RegArrayNum -1] = new RegExp(); 59 | return RegArray[i]->RegisterWildCard(wild_str, cs); 60 | } 61 | BOOL IsMatch(const void *target) { 62 | for (int i=0; i < RegArrayNum; i++) { 63 | if (RegArray[i]->IsMatch(target)) return TRUE; 64 | } 65 | return FALSE; 66 | } 67 | BOOL IsRegistered(void) { return RegArrayNum ? TRUE : FALSE; } 68 | 69 | protected: 70 | RegExp **RegArray; 71 | int RegArrayNum; 72 | }; 73 | 74 | -------------------------------------------------------------------------------- /src/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Developer Studio generated include file. 3 | // Used by FastCopy.rc 4 | // 5 | #define IDC_STATIC -1 6 | #define IDS_MKDIR 1 7 | #define IDS_RMDIR 2 8 | #define IDS_SRC_SELECT 3 9 | #define IDS_DST_SELECT 4 10 | #define IDS_SAMEDISK 5 11 | #define IDS_DIFFDISK 6 12 | #define IDS_FIX_SAMEDISK 7 13 | #define IDS_FIX_DIFFDISK 8 14 | #define IDS_ALLSKIP 20 15 | #define IDS_ATTRCMP 21 16 | #define IDS_UPDATECOPY 22 17 | #define IDS_FORCECOPY 23 18 | #define IDS_SYNCCOPY 24 19 | #define IDS_MUTUAL 25 20 | #define IDS_MOVEATTR 26 21 | #define IDS_MOVEFORCE 27 22 | #define IDS_DELETE 28 23 | #define IDS_EXECUTE 29 24 | #define IDS_CANCEL 30 25 | #define IDS_BEHAVIOR 31 26 | #define IDS_UPDATE 32 27 | #define IDS_FILESELECT 33 28 | #define IDS_DIRSELECT 34 29 | #define IDS_SAMEPATHERR 41 30 | #define IDS_PARENTPATHERR 42 31 | #define IDS_MOVECONFIRM 43 32 | #define IDS_SHELLEXT_MODIFY 44 33 | #define IDS_SHELLEXT_EXEC 45 34 | #define IDS_FASTCOPYURL 46 35 | #define IDS_FASTCOPYHELP 47 36 | #define IDS_EXCEPTIONLOG 48 37 | #define IDS_SYNCCONFIRM 49 38 | #define IDS_BACKSLASHERR 50 39 | #define IDS_ERRSTOP 60 40 | #define IDS_CONFIRMFORCEEND 61 41 | #define IDS_STOPCONFIRM 62 42 | #define IDS_DELSTOPCONFIRM 63 43 | #define IDS_DELCONFIRM 64 44 | #define IDS_DUPCONFIRM 65 45 | #define IDS_NOFILTER_USAGE 66 46 | #define IDS_LISTCONFIRM 67 47 | #define IDS_JOBNAME 68 48 | #define IDS_JOBNOTFOUND 69 49 | #define IDS_LISTING 70 50 | #define IDS_REQUIRE_ADMIN 71 51 | #define IDS_FIXPOS_MSG 72 52 | #define IDS_FIXSIZE_MSG 73 53 | #define IDS_FINACTNAME 74 54 | #define IDS_FINACTMENU 75 55 | #define IDS_FINACT_NORMAL 76 56 | #define IDS_ELEVATE 77 57 | #define IDS_SHUTDOWN_MSG 78 58 | #define IDS_HIBERNATE_MSG 79 59 | #define IDS_SUSPEND_MSG 80 60 | #define IDS_FINACT_SUSPEND 81 61 | #define IDS_FINACT_HIBERNATE 82 62 | #define IDS_FINACT_SHUTDOWN 83 63 | #define IDS_DATEFORMAT_MSG 84 64 | #define IDS_SIZEFORMAT_MSG 85 65 | #define IDS_UNDO 100 66 | #define IDS_CUT 101 67 | #define IDS_COPY 102 68 | #define IDS_PASTE 103 69 | #define IDS_DEL 104 70 | #define IDS_SELECTALL 105 71 | #define IDS_SETUP_SHEET1 106 72 | #define IDS_SETUP_SHEET2 107 73 | #define IDS_SETUP_SHEET3 108 74 | #define IDS_SETUP_SHEET4 109 75 | #define IDS_SETUP_SHEET5 110 76 | #define IDS_SETUP_SHEET6 111 77 | #define SETUP_SHEET1 202 78 | #define SETUP_SHEET2 203 79 | #define SETUP_SHEET3 204 80 | #define SETUP_SHEET4 205 81 | #define SETUP_SHEET5 206 82 | #define SETUP_SHEET6 207 83 | #define IDS_FASTCOPY 1000 84 | #define IDS_USAGE 1001 85 | #define IDS_CMD_NOEXIST_ONLY 1080 86 | #define IDS_CMD_DIFF 1081 87 | #define IDS_CMD_UPDATE 1082 88 | #define IDS_CMD_FORCE_COPY 1083 89 | #define IDS_CMD_SYNC 1084 90 | #define IDS_CMD_MUTUAL 1085 91 | #define IDS_CMD_MOVE 1086 92 | #define IDS_CMD_DELETE 1087 93 | #define IDS_CMD_OPT 1088 94 | #define IDS_CMD_MOVEDIFF 1089 95 | #define IDS_CMD_MOVEATTR 1089 96 | #define IDS_BUFSIZE_OPT 1090 97 | #define IDS_ERRSTOP_OPT 1091 98 | #define IDS_OPENWIN_OPT 1092 99 | #define IDS_AUTOCLOSE_OPT 1093 100 | #define IDS_FORCECLOSE_OPT 1094 101 | #define IDS_NOEXEC_OPT 1095 102 | #define IDS_NOCONFIRMDEL_OPT 1096 103 | #define IDS_LOG_OPT 1097 104 | #define IDS_TO_OPT 1098 105 | #define IDS_ESTIMATE_OPT 1099 106 | #define IDS_JOB_OPT 1100 107 | #define IDS_AUTOSLOW_OPT 1101 108 | #define IDS_SPEED_OPT 1102 109 | #define IDS_UTF8LOG_OPT 1103 110 | #define IDS_ALLFILES_FILTER 1104 111 | #define IDS_SHEXT1_OPT 1111 112 | #define IDS_SHEXT2_OPT 1112 113 | #define IDS_SHEXT4_OPT 1113 114 | #define IDS_FCSHEXT1_OPT 1114 115 | #define IDS_INCLUDE_OPT 1115 116 | #define IDS_EXCLUDE_OPT 1117 117 | #define IDS_REGEXP_OPT 1119 118 | #define IDS_FORCESTART_OPT 1120 119 | #define IDS_SKIPEMPTYDIR_OPT 1121 120 | #define IDS_DISKMODE_OPT 1122 121 | #define IDS_DISKMODE_SAME 1123 122 | #define IDS_DISKMODE_DIFF 1124 123 | #define IDS_DISKMODE_AUTO 1125 124 | #define IDS_ACL_OPT 1126 125 | #define IDS_STREAM_OPT 1127 126 | #define IDS_OWDEL_OPT 1128 127 | #define IDS_SPEED_FULL 1129 128 | #define IDS_SPEED_AUTOSLOW 1130 129 | #define IDS_SPEED_SUSPEND 1131 130 | #define IDS_REPARSE_OPT 1132 131 | #define IDS_RUNAS_OPT 1133 132 | #define IDS_USERDIR_MENU 1134 133 | #define IDS_LOGFILE_OPT 1135 134 | #define IDS_NOCONFIRMSTOP_OPT 1136 135 | #define IDS_VERIFY_OPT 1137 136 | #define IDS_SHEXT_NOCONFIRM_OPT 1138 137 | #define IDS_USERDIROLD_MENU 1138 138 | #define IDS_USEROLDDIR_MENU 1138 139 | #define IDS_WIPEDEL_OPT 1139 140 | #define IDS_SRCFILE_OPT 1140 141 | #define IDS_SRCFILEW_OPT 1141 142 | #define IDS_FINACT_OPT 1142 143 | #define IDS_NOTEPAD 1146 144 | #define IDS_LINKDEST_OPT 1147 145 | #define IDS_RECREATE_OPT 1148 146 | #define IDS_FROMDATE_OPT 1149 147 | #define IDS_TODATE_OPT 1150 148 | #define IDS_MINSIZE_OPT 1151 149 | #define IDS_MAXSIZE_OPT 1152 150 | #define IDS_STANDBY 1153 151 | #define IDS_HIBERNATE 1154 152 | #define IDS_SHUTDOWN 1155 153 | #define IDS_FILELOG_OPT 1156 154 | #define IDS_TRUE 1157 155 | #define IDS_FALSE 1158 156 | #define IDS_FILELOGNAME 1159 157 | #define IDS_FILELOG_SUBDIR 1160 158 | #define SETTING_LIST 1160 159 | #define IDS_FULLSPEED_DISP 1161 160 | #define IDS_AUTOSLOW_DISP 1162 161 | #define SETUP_SHEET_BASE 1162 162 | #define IDS_SUSPEND_DISP 1163 163 | #define SETUP_LIST 1163 164 | #define IDS_RATE_DISP 1164 165 | #define STREAMERRLOG_CHECK 1164 166 | #define ACLERRLOG_CHECK 1165 167 | #define MAIN_DIALOG 2331 168 | #define INPUT_DIALOG 2332 169 | #define SETUP_DIALOG 2333 170 | #define CONFIRM_DIALOG 2360 171 | #define COPYCONFIRM_DIALOG 2361 172 | #define ABOUT_DIALOG 2370 173 | #define SHELLEXT_DIALOG 2371 174 | #define DELCONFIRM_DIALOG 2373 175 | #define JOB_DIALOG 2376 176 | #define MESSAGE_DIALOG 2379 177 | #define FINACTION_DIALOG 2380 178 | #define USERDIROLD_MENUITEM 2381 179 | #define PROP_MISC 2381 180 | #define SRC_FILE_BUTTON 3003 181 | #define DST_FILE_BUTTON 3004 182 | #define SRC_COMBO 3006 183 | #define DST_COMBO 3007 184 | #define ERRLOG_CHECK 3008 185 | #define BUFSIZE_EDIT 3009 186 | #define HISTORY_EDIT 3010 187 | #define NONBUFMINNTFS_EDIT 3011 188 | #define IGNORE_CHECK 3012 189 | #define INPUT_EDIT 3013 190 | #define FILELOG_CHECK 3013 191 | #define NONBUFMINFAT_EDIT 3014 192 | #define STATUS_EDIT 3015 193 | #define UTF8LOG_CHECK 3016 194 | #define SAMEDRV_STATIC 3019 195 | #define PATH_EDIT 3020 196 | #define MODE_COMBO 3021 197 | #define ERR_EDIT 3022 198 | #define HELP_BUTTON 3026 199 | #define MESSAGE_EDIT 3029 200 | #define MESSAGE_EDIT2 3030 201 | #define ERR_STATIC 3031 202 | #define ERRSTATUS_STATIC 3032 203 | #define URL_BUTTON 3034 204 | #define IDSHELLEXT_CANCEL 3040 205 | #define DD_COPY_CHECK 3041 206 | #define DD_MOVE_CHECK 3042 207 | #define IDSHELLEXT_OK 3043 208 | #define AUTOCLOSE_CHECK 3045 209 | #define SRC_EDIT 3046 210 | #define TASKTRAY_CHECK 3047 211 | #define DST_EDIT 3048 212 | #define EXECCONFIRM_CHECK 3049 213 | #define MAXTRANS_EDIT 3050 214 | #define TOPLEVEL_CHECK 3051 215 | #define LCID_CHECK 3052 216 | #define RIGHT_NOCONFIRM_CHECK 3053 217 | #define DD_NOCONFIRM_CHECK 3054 218 | #define RIGHT_COPY_CHECK 3055 219 | #define RIGHT_DELETE_CHECK 3056 220 | #define RIGHT_SUBMENU_CHECK 3057 221 | #define DD_SUBMENU_CHECK 3058 222 | #define ESTIMATE_CHECK 3059 223 | #define SAMEDIR_RENAME_CHECK 3060 224 | #define INCLUDE_COMBO 3061 225 | #define RIGHT_PASTE_CHECK 3062 226 | #define EXCLUDE_COMBO 3063 227 | #define FILTER_CHECK 3064 228 | #define HELP_CONFIRM_BUTTON 3065 229 | #define SPEED_CHECK 3066 230 | #define ACL_CHECK 3067 231 | #define STREAM_CHECK 3068 232 | #define OWDEL_CHECK 3069 233 | #define ATONCE_BUTTON 3070 234 | #define LIST_BUTTON 3071 235 | #define BUF_STATIC 3072 236 | #define INC_STATIC 3073 237 | #define EXC_STATIC 3074 238 | #define VERIFY_CHECK 3075 239 | #define EMPTYDIR_CHECK 3076 240 | #define FORCESTART_CHECK 3077 241 | #define ABOUT_STATIC 3078 242 | #define NSA_CHECK 3079 243 | #define MOVEATTR_CHECK 3080 244 | #define SERIALMOVE_CHECK 3081 245 | #define JOB_COMBO 3082 246 | #define EXTENDFILTER_CHECK 3082 247 | #define DELDIR_CHECK 3082 248 | #define JOBTITLE_STATIC 3083 249 | #define JOB_STATIC 3084 250 | #define JOBDEL_BUTTON 3085 251 | #define SPEED_STATIC 3086 252 | #define AUTOSLOW_CHECK 3087 253 | #define AUTOSLOW_STATIC 3088 254 | #define AUTOSLOWIO_CHECK 3089 255 | #define SPEED_SLIDER 3103 256 | #define REPARSE_CHECK 3104 257 | #define RUNAS_BUTTON 3105 258 | #define SERIALVERIFYMOVE_CHECK 3106 259 | #define MAIN_LISTVIEW 3107 260 | #define MAIN_LIST 3109 261 | #define READOSBUF_CHECK 3110 262 | #define NOCONFIRMDEL_CHECK 3116 263 | #define NOCONFIRM_CHECK 3118 264 | #define TITLE_COMBO 3123 265 | #define DEL_BUTTON 3124 266 | #define SOUND_EDIT 3125 267 | #define SOUND_BUTTON 3126 268 | #define CMD_EDIT 3127 269 | #define CMD_BUTTON 3128 270 | #define SHUTDOWN_CHECK 3129 271 | #define SHUTDOWNTIME_EDIT 3130 272 | #define FORCESHUTDOWN_CHECK 3131 273 | #define ADD_BUTTON 3132 274 | #define CMDERR_CHECK 3133 275 | #define SHUTDOWNERR_CHECK 3134 276 | #define SOUNDERR_CHECK 3135 277 | #define WAITCMD_CHECK 3137 278 | #define FORCE_CHECK 3141 279 | #define SUSPEND_CHECK 3142 280 | #define HIBERNATE_CHECK 3143 281 | #define PLAY_BUTTON 3144 282 | #define FROMDATE_STATIC 3149 283 | #define TODATE_STATIC 3150 284 | #define TODATE_COMBO 3151 285 | #define MAXSIZE_COMBO 3152 286 | #define MINSIZE_STATIC 3153 287 | #define FROMDATE_COMBO 3154 288 | #define MINSIZE_COMBO 3155 289 | #define MAXSIZE_STATIC 3156 290 | #define DST_STATIC 3157 291 | #define DRIVEMAP_EDIT 3158 292 | #define FILESELECT_BUTTON 3335 293 | #define DIRSELECT_BUTTON 3336 294 | #define MKDIR_BUTTON 3380 295 | #define RMDIR_BUTTON 3381 296 | #define MINITOTRAY_CHECK 3382 297 | #define FASTCOPY_ICON 4000 298 | #define FASTCOPY2_ICON 4001 299 | #define FASTCOPY3_ICON 4002 300 | #define FASTCOPY4_ICON 4003 301 | #define FCWAIT_ICON 4004 302 | #define JOBOBJ_MENUITEM_START 5000 303 | #define JOBOBJ_MENUITEM_END 5999 304 | #define FINACT_MENUITEM_START 6000 305 | #define FINACT_MENUITEM_END 6999 306 | #define MAIN_MENU 7000 307 | #define MAIN_RUNAS_MENU 8001 308 | #define IDR_ACCEL 9000 309 | #define CLOSE_MENUITEM 30003 310 | #define SETUP_MENUITEM 30004 311 | #define HELP_MENUITEM 30006 312 | #define ABOUT_MENUITEM 30007 313 | #define SHELLEXT_MENUITEM 30008 314 | #define OPENDIR_MENUITEM 30009 315 | #define FASTCOPYURL_MENUITEM 30010 316 | #define JOB_MENUITEM 30013 317 | #define IDR_DISKMODE 30014 318 | #define AUTODISK_MENUITEM 30016 319 | #define SAMEDISK_MENUITEM 30017 320 | #define DIFFDISK_MENUITEM 30018 321 | #define USERDIR_MENUITEM 30019 322 | #define ADMIN_MENUITEM 30021 323 | #define SWAPTARGET_MENUITEM 30022 324 | #define FIXPOS_MENUITEM 30023 325 | #define FIXSIZE_MENUITEM 30024 326 | #define DEFFINACT_MENUITEM 30025 327 | #define FINACT_MENUITEM 30026 328 | #define OPENLOG_MENUITEM 30027 329 | #define EXTENDFILTER_MENUITEM 30028 330 | #define IDR_SWAPTARGET 30029 331 | 332 | // Next default values for new objects 333 | // 334 | #ifdef APSTUDIO_INVOKED 335 | #ifndef APSTUDIO_READONLY_SYMBOLS 336 | #define _APS_NO_MFC 1 337 | #define _APS_3D_CONTROLS 1 338 | #define _APS_NEXT_RESOURCE_VALUE 208 339 | #define _APS_NEXT_COMMAND_VALUE 30030 340 | #define _APS_NEXT_CONTROL_VALUE 1166 341 | #define _APS_NEXT_SYMED_VALUE 2382 342 | #endif 343 | #endif 344 | -------------------------------------------------------------------------------- /src/shellext/FastEx64.dll.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | FastCopy Shell Extension http://ipmsg.org/tools/fastcopy.html 10 | 11 | 12 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /src/shellext/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Developer Studio generated include file. 3 | // Used by shellext.rc 4 | // 5 | #define IDS_RIGHTCOPY 1 6 | #define IDS_RIGHTDEL 2 7 | #define IDS_DDCOPY 3 8 | #define IDS_DDMOVE 4 9 | #define IDS_RIGHTPASTE 5 10 | 11 | // Next default values for new objects 12 | // 13 | #ifdef APSTUDIO_INVOKED 14 | #ifndef APSTUDIO_READONLY_SYMBOLS 15 | #define _APS_NEXT_RESOURCE_VALUE 101 16 | #define _APS_NEXT_COMMAND_VALUE 40001 17 | #define _APS_NEXT_CONTROL_VALUE 1000 18 | #define _APS_NEXT_SYMED_VALUE 101 19 | #endif 20 | #endif 21 | -------------------------------------------------------------------------------- /src/shellext/shell64.def: -------------------------------------------------------------------------------- 1 | LIBRARY "fastex64" 2 | EXPORTS 3 | DllCanUnloadNow PRIVATE 4 | DllGetClassObject PRIVATE 5 | DllRegisterServer PRIVATE 6 | DllUnregisterServer PRIVATE 7 | SetMenuFlags PRIVATE 8 | GetMenuFlags PRIVATE 9 | IsRegistServer PRIVATE 10 | UpdateDll PRIVATE 11 | 12 | -------------------------------------------------------------------------------- /src/shellext/shelldef.h: -------------------------------------------------------------------------------- 1 | /* static char *shelldef_id = 2 | "@(#)Copyright (C) 2005-2010 H.Shirouzu shelldef.h Ver1.92"; */ 3 | /* ======================================================================== 4 | Project Name : Fast/Force copy file and directory 5 | Create : 2008-06-05(Thu) 6 | Update : 2010-05-09(Sun) 7 | Copyright : H.Shirouzu 8 | Reference : 9 | ======================================================================== */ 10 | 11 | #ifndef SHELLDEF_H 12 | #define SHELLDEF_H 13 | 14 | #define FASTCOPY "FastCopy" 15 | #define FASTCOPY_EXE "FastCopy.exe" 16 | #define SHELLEXT_OPT "/fc_shell_ext1" 17 | 18 | #define MENU_FLAGS_OLD "FastCopyMenuFlags" 19 | #define MENU_FLAGS "FastCopyMenuFlags2" 20 | #define SHEXT_RIGHT_COPY 0x00000001 21 | #define SHEXT_RIGHT_DELETE 0x00000002 22 | #define SHEXT_RIGHT_PASTE 0x00000004 23 | #define SHEXT_DD_COPY 0x00000010 24 | #define SHEXT_DD_MOVE 0x00000020 25 | #define SHEXT_SUBMENU_RIGHT 0x00001000 26 | #define SHEXT_SUBMENU_DD 0x00002000 27 | #define SHEXT_SUBMENU_NOSEP 0x00004000 28 | #define SHEXT_ISSTOREOPT 0x00010000 29 | #define SHEXT_NOCONFIRM 0x00020000 30 | #define SHEXT_NOCONFIRMDEL 0x00040000 31 | #define SHEXT_TASKTRAY 0x00080000 32 | #define SHEXT_AUTOCLOSE 0x00100000 33 | #define SHEXT_MENUFLG_EX 0x80000000 34 | #define SHEXT_MENU_DEFAULT 0xfff00fff 35 | #define SHEXT_MENU_NEWDEF 0xfff00fcc 36 | 37 | #define SHEXT_RIGHT_MENUS (SHEXT_RIGHT_COPY|SHEXT_RIGHT_DELETE|SHEXT_RIGHT_PASTE) 38 | #define SHEXT_DD_MENUS (SHEXT_DD_COPY|SHEXT_DD_MOVE) 39 | 40 | #define SHEXT_MENU_COPY 0x00000000 41 | #define SHEXT_MENU_DELETE 0x00000001 42 | #define SHEXT_MENU_PASTE 0x00000002 43 | #define SHEXT_MENU_MAX 0x00000003 44 | 45 | 46 | #endif 47 | 48 | -------------------------------------------------------------------------------- /src/shellext/shellext.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/laurent22/fastcopy/96b6c6b236a53763c3a011aae78d3be6f8bc3c85/src/shellext/shellext.cpp -------------------------------------------------------------------------------- /src/shellext/shellext.def: -------------------------------------------------------------------------------- 1 | LIBRARY "fastext1" 2 | EXPORTS 3 | DllCanUnloadNow PRIVATE 4 | DllGetClassObject PRIVATE 5 | DllRegisterServer PRIVATE 6 | DllUnregisterServer PRIVATE 7 | SetMenuFlags PRIVATE 8 | GetMenuFlags PRIVATE 9 | IsRegistServer PRIVATE 10 | UpdateDll PRIVATE 11 | 12 | -------------------------------------------------------------------------------- /src/shellext/shellext.h: -------------------------------------------------------------------------------- 1 | /* static char *shellext_id = 2 | "@(#)Copyright (C) 2005-2010 H.Shirouzu shellext.h Ver2.04"; */ 3 | /* ======================================================================== 4 | Project Name : Fast/Force copy file and directory 5 | Create : 2005-01-23(Sun) 6 | Update : 2010-11-04(Thu) 7 | Copyright : H.Shirouzu 8 | Reference : 9 | ======================================================================== */ 10 | 11 | #ifndef SHELLEXT_H 12 | #define SHELLEXT_H 13 | 14 | #if _MSC_VER <= 1200 15 | #define UINT_PTR UINT 16 | #endif 17 | 18 | #ifndef CFSTR_PREFERREDDROPEFFECT 19 | #define CFSTR_PREFERREDDROPEFFECT "Preferred DropEffect" 20 | #endif 21 | 22 | #define REG_SHELL_APPROVED \ 23 | "Software\\Microsoft\\Windows\\CurrentVersion\\Shell Extensions\\Approved" 24 | 25 | // Current CLSID for all file // {72FF462B-AB7D-427a-A268-E22E414933D7} 26 | DEFINE_GUID(CLSID_FcShellExtID1, 0x72ff462b, 0xab7d, 0x427a, 0xa2, 0x68, 0xe2, \ 27 | 0x2e, 0x41, 0x49, 0x33, 0xd7); 28 | // Current CLSID for .lnk file {19FD02CE-C890-4c90-A591-CEF8BE893DFC} 29 | DEFINE_GUID(CLSID_FcShellExtLinkID1, 0x19fd02ce, 0xc890, 0x4c90, 0xa5, 0x91, 0xce, \ 30 | 0xf8, 0xbe, 0x89, 0x3d, 0xfc); 31 | 32 | #define CURRENT_SHEXT_CLSID CLSID_FcShellExtID1 33 | #define CURRENT_SHEXTLNK_CLSID CLSID_FcShellExtLinkID1 34 | 35 | int AddDllRef(int incr); 36 | int GetDllRef(void); 37 | 38 | int MakePath(char *dest, const char *dir, const char *file); 39 | int MakePathW(WCHAR *dest, const WCHAR *dir, const WCHAR *file); 40 | BOOL GetClsId(REFIID cls_name, char *cls_id, int size); 41 | BOOL WINAPI SetMenuFlags(int flags); 42 | int WINAPI GetMenuFlags(void); 43 | BOOL WINAPI IsRegistServer(void); 44 | 45 | class PathArray { 46 | protected: 47 | int num; 48 | int totalLen; 49 | void **pathArray; 50 | 51 | public: 52 | PathArray(void); 53 | ~PathArray(); 54 | void Init(void); 55 | void *Path(int idx) { return idx < num ? pathArray[idx] : NULL; } 56 | int GetMultiPath(void *multi_path, int max_len); 57 | int GetMultiPathLen(); 58 | int Num(void) { return num; } 59 | BOOL RegisterPath(const void *path); 60 | PathArray &operator =(PathArray &src) { 61 | Init(); for(int i=0; i < src.Num(); i++) RegisterPath(src.Path(i)); return *this; 62 | } 63 | }; 64 | 65 | class ShellExt : public IContextMenu, IShellExtInit 66 | { 67 | protected: 68 | ULONG refCnt; 69 | IDataObject *dataObj; 70 | PathArray srcArray; 71 | PathArray dstArray; 72 | PathArray clipArray; 73 | BOOL isCut; 74 | 75 | public: 76 | ShellExt(void); 77 | ~ShellExt(); 78 | 79 | BOOL DeleteMenu(UINT *del_idx); 80 | BOOL GetClipBoardInfo(PathArray *pathArray, BOOL *is_cut); 81 | BOOL IsDir(void *path, BOOL is_resolve); 82 | 83 | STDMETHODIMP Initialize(LPCITEMIDLIST pIDFolder, IDataObject *pDataObj, HKEY hRegKey); 84 | STDMETHODIMP QueryInterface(REFIID riid, void **ppv); 85 | STDMETHODIMP QueryContextMenu(HMENU hMenu, UINT iMenu, UINT cmdFirst, UINT cmdLast, UINT flg); 86 | STDMETHODIMP InvokeCommand(CMINVOKECOMMANDINFO *info); 87 | STDMETHODIMP GetCommandString(UINT_PTR cmd, UINT flg, UINT *, char *name, UINT cchMax); 88 | STDMETHODIMP_(ULONG) AddRef(); 89 | STDMETHODIMP_(ULONG) Release(); 90 | }; 91 | 92 | class ShellExtClassFactory : public IClassFactory 93 | { 94 | protected: 95 | ULONG refCnt; 96 | 97 | public: 98 | ShellExtClassFactory(void); 99 | ~ShellExtClassFactory(); 100 | 101 | STDMETHODIMP CreateInstance(IUnknown *pUnkOuter, REFIID riid, void **ppvObj); 102 | STDMETHODIMP LockServer(BOOL fLock); 103 | STDMETHODIMP QueryInterface(REFIID riid, void **ppv); 104 | STDMETHODIMP_(ULONG) AddRef(); 105 | STDMETHODIMP_(ULONG) Release(); 106 | }; 107 | 108 | class TShellExtRegistry : public TRegistry { 109 | public: 110 | char clsId[MAX_PATH]; 111 | 112 | TShellExtRegistry(REFIID cls_name=CURRENT_SHEXT_CLSID); 113 | BOOL CreateClsKey() { return CreateKey(clsId); } 114 | BOOL OpenClsKey() { return OpenKey(clsId); } 115 | }; 116 | 117 | class ShellExtSystem { 118 | public: 119 | HINSTANCE HInstance; 120 | int DllRefCnt; 121 | char *DllName; 122 | char *ExeName; 123 | char *MenuFlgRegKey; 124 | HMENU lastMenu; 125 | 126 | ShellExtSystem(HINSTANCE hI); 127 | ~ShellExtSystem(); 128 | }; 129 | 130 | // for VC4 131 | #ifndef CMF_NOVERBS 132 | #define CMF_NOVERBS 0x00000008 133 | #define CMF_CANRENAME 0x00000010 134 | #define CMF_NODEFAULT 0x00000020 135 | #define CMF_INCLUDESTATIC 0x00000040 136 | #endif 137 | 138 | DEFINE_GUID(CLSID_ShellExtID1, 0x9bc20d5, 0x3ebc, 0x4f43, 0x89, 0x6b, 0xa1, 0x76, 0xba, \ 139 | 0x63, 0x64, 0x6f); // OLD1 CLSID {09BC20D5-3EBC-4f43-896B-A176BA63646F} 140 | DEFINE_GUID(CLSID_ShellExtID2, 0x644aad22, 0x704b, 0x4b2d, 0x93, 0x50, 0xfe, 0x94, 0xfe, \ 141 | 0x66, 0xae, 0x54); // OLD2 CLSID for all file {644AAD22-704B-4b2d-9350-FE94FE66AE54} 142 | DEFINE_GUID(CLSID_ShellExtLinkID2, 0xd52ba7ce, 0xe594, 0x4542, 0xb0, 0x42, 0xb1, 0xed, 0x70, \ 143 | 0x8f, 0xe6, 0x4); // OLD2 CLSID for .lnk file {D52BA7CE-E594-4542-B042-B1ED708FE604} 144 | 145 | DEFINE_GUID(CLSID_ShellExtID3, 0x18edb5af, 0xa764, 0x4079, 0xa2, 0xd7, 0x8c, 0x30, 0x89, \ 146 | 0xd4, 0x38, 0x46); // OLD3 CLSID for all file {18EDB5AF-A764-4079-A2D7-8C3089D43846} 147 | DEFINE_GUID(CLSID_ShellExtLinkID3, 0x95f3be2f, 0xdd53, 0x4bb3, 0xb1, 0xd1, 0x83, 0xc1, 0xc8, \ 148 | 0x40, 0x40, 0x97); // OLD3 CLSID for .lnk file {95F3BE2F-DD53-4bb3-B1D1-83C1C8404097} 149 | 150 | DEFINE_GUID(CLSID_ShellExtID4, 0xa17026e8, 0x7c80, 0x48a5, 0xb6, 0x44, 0xbd, 0xb7, 0xf, \ 151 | 0x92, 0xd1, 0x24); // OLD4 CLSID for all file {A17026E8-7C80-48a5-B644-BDB70F92D124} 152 | DEFINE_GUID(CLSID_ShellExtLinkID4, 0x915def58, 0x5635, 0x4cff, 0x86, 0xf9, 0x83, 0x11, 0x4f, \ 153 | 0xdc, 0x66, 0xc8); // OLD4 CLSID for .lnk file {A17026E8-7C80-48a5-B644-BDB70F92D124} 154 | 155 | #endif 156 | 157 | -------------------------------------------------------------------------------- /src/shellext/shellext.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/laurent22/fastcopy/96b6c6b236a53763c3a011aae78d3be6f8bc3c85/src/shellext/shellext.rc -------------------------------------------------------------------------------- /src/tlib/tapi32ex.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/laurent22/fastcopy/96b6c6b236a53763c3a011aae78d3be6f8bc3c85/src/tlib/tapi32ex.cpp -------------------------------------------------------------------------------- /src/tlib/tapi32ex.h: -------------------------------------------------------------------------------- 1 | /* @(#)Copyright (C) 1996-2010 H.Shirouzu tapi32ex.h Ver0.99 */ 2 | /* ======================================================================== 3 | Project Name : Win32 Lightweight Class Library Test 4 | Module Name : Main Header 5 | Create : 2005-04-10(Sun) 6 | Update : 2010-05-09(Sun) 7 | Copyright : H.Shirouzu 8 | Reference : 9 | ======================================================================== */ 10 | 11 | #ifndef TAPI32EX_H 12 | #define TAPI32EX_H 13 | 14 | #include 15 | 16 | #define CP_UTF8 65001 // UTF-8 translation 17 | inline int AtoW(const char *src, WCHAR *dst, int bufsize, int max_len=-1) { 18 | return ::MultiByteToWideChar(CP_ACP, 0, src, max_len, dst, bufsize); 19 | } 20 | inline int WtoA(const WCHAR *src, char *dst, int bufsize, int max_len=-1) { 21 | return ::WideCharToMultiByte(CP_ACP, 0, src, max_len, dst, bufsize, 0, 0); 22 | } 23 | 24 | WCHAR *AtoW(const char *src, BOOL noStatic=FALSE); 25 | 26 | #if _MSC_VER < 1200 27 | 28 | #define MIDL_INTERFACE(x) interface 29 | 30 | #ifndef __IShellLinkW_INTERFACE_DEFINED__ 31 | #define __IShellLinkW_INTERFACE_DEFINED__ 32 | 33 | EXTERN_C const IID IID_IShellLinkW; 34 | 35 | MIDL_INTERFACE("000214F9-0000-0000-C000-000000000046") 36 | IShellLinkW : public IUnknown 37 | { 38 | public: 39 | virtual HRESULT STDMETHODCALLTYPE 40 | GetPath(LPWSTR pszFile, int cch, WIN32_FIND_DATAW *pfd, DWORD fFlags) = 0; 41 | }; 42 | 43 | #endif /* __IShellLinkW_INTERFACE_DEFINED__ */ 44 | 45 | #define EN_LINK 0x070b 46 | typedef struct _enlink 47 | { 48 | NMHDR nmhdr; 49 | UINT msg; 50 | WPARAM wParam; 51 | LPARAM lParam; 52 | CHARRANGE chrg; 53 | } ENLINK; 54 | 55 | #define EM_GETTEXTEX (WM_USER + 94) 56 | typedef struct _gettextex 57 | { 58 | DWORD cb; // Count of bytes in the string 59 | DWORD flags; // Flags (see the GT_XXX defines 60 | UINT codepage; // Code page for translation (CP_ACP for sys default, 61 | // 1200 for Unicode, -1 for control default) 62 | LPCSTR lpDefaultChar; // Replacement for unmappable chars 63 | LPBOOL lpUsedDefChar; // Pointer to flag set when def char used 64 | } GETTEXTEX; 65 | 66 | #endif 67 | 68 | #ifndef EM_SETTEXTEX 69 | #define EM_SETTEXTEX (WM_USER + 97) 70 | // EM_SETTEXTEX info; this struct is passed in the wparam of the message 71 | typedef struct _settextex 72 | { 73 | DWORD flags; // Flags (see the ST_XXX defines) 74 | UINT codepage; // Code page for translation (CP_ACP for sys default, 75 | // 1200 for Unicode, -1 for control default) 76 | } SETTEXTEX; 77 | 78 | // Flags for the SETEXTEX data structure 79 | #define ST_DEFAULT 0 80 | #define ST_KEEPUNDO 1 81 | #define ST_SELECTION 2 82 | #define ST_NEWCHARS 4 83 | 84 | // Flags for the GETEXTEX data structure 85 | #define GT_DEFAULT 0 86 | #define GT_USECRLF 1 87 | #define GT_SELECTION 2 88 | #define GT_RAWTEXT 4 89 | #define GT_NOHIDDENTEXT 8 90 | 91 | #define EM_SETLANGOPTIONS (WM_USER + 120) 92 | #define EM_GETLANGOPTIONS (WM_USER + 121) 93 | #define IMF_DUALFONT 0x0080 94 | #endif 95 | 96 | #if _MSC_VER < 1200 97 | 98 | typedef struct _browseinfoA { 99 | HWND hwndOwner; 100 | LPCITEMIDLIST pidlRoot; 101 | LPSTR pszDisplayName; // Return display name of item selected. 102 | LPCSTR lpszTitle; // text to go in the banner over the tree. 103 | UINT ulFlags; // Flags that control the return stuff 104 | BFFCALLBACK lpfn; 105 | LPARAM lParam; // extra info that's passed back in callbacks 106 | int iImage; // output var: where to return the Image index. 107 | } BROWSEINFOA, *PBROWSEINFOA, *LPBROWSEINFOA; 108 | 109 | typedef struct _browseinfoW { 110 | HWND hwndOwner; 111 | LPCITEMIDLIST pidlRoot; 112 | LPWSTR pszDisplayName; // Return display name of item selected. 113 | LPCWSTR lpszTitle; // text to go in the banner over the tree. 114 | UINT ulFlags; // Flags that control the return stuff 115 | BFFCALLBACK lpfn; 116 | LPARAM lParam; // extra info that's passed back in callbacks 117 | int iImage; // output var: where to return the Image index. 118 | } BROWSEINFOW, *PBROWSEINFOW, *LPBROWSEINFOW; 119 | 120 | #endif 121 | 122 | #define BFFM_SETSELECTIONW (WM_USER + 103) 123 | #define LVM_INSERTITEMW (LVM_FIRST + 77) 124 | DEFINE_GUID(IID_IShellLinkW, 0x000214F9, \ 125 | 0x0000, 0000, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46); 126 | 127 | #ifndef BIF_NEWDIALOGSTYLE 128 | 129 | #define BIF_EDITBOX 0x0010 130 | #define BIF_VALIDATE 0x0020 131 | #define BIF_NEWDIALOGSTYLE 0x0040 132 | #define BIF_USENEWUI (BIF_NEWDIALOGSTYLE | BIF_EDITBOX) 133 | 134 | #define BIF_BROWSEINCLUDEURLS 0x0080 135 | #define BIF_UAHINT 0x0100 136 | #define BIF_NONEWFOLDERBUTTON 0x0200 137 | #define BIF_NOTRANSLATETARGETS 0x0400 138 | 139 | #define BIF_BROWSEINCLUDEFILES 0x4000 140 | #define BIF_SHAREABLE 0x8000 141 | 142 | #endif 143 | 144 | // CryptoAPI for VC4 145 | #ifndef MS_DEF_PROV 146 | typedef unsigned long HCRYPTPROV; 147 | typedef unsigned long HCRYPTKEY; 148 | typedef unsigned long HCRYPTHASH; 149 | typedef unsigned int ALG_ID; 150 | #define ALG_TYPE_RSA (2 << 9) 151 | #define ALG_TYPE_BLOCK (3 << 9) 152 | #define ALG_CLASS_DATA_ENCRYPT (3 << 13) 153 | #define ALG_CLASS_HASH (4 << 13) 154 | #define ALG_CLASS_KEY_EXCHANGE (5 << 13) 155 | #define ALG_SID_RSA_ANY 0 156 | #define ALG_TYPE_ANY 0 157 | #define ALG_SID_RC2 2 158 | #define ALG_SID_MD5 3 159 | #define ALG_SID_SHA 4 160 | #define CALG_RSA_KEYX (ALG_CLASS_KEY_EXCHANGE|ALG_TYPE_RSA|ALG_SID_RSA_ANY) 161 | #define CALG_RC2 (ALG_CLASS_DATA_ENCRYPT|ALG_TYPE_BLOCK|ALG_SID_RC2) 162 | #define CALG_MD5 (ALG_CLASS_HASH|ALG_TYPE_ANY|ALG_SID_MD5) 163 | #define CALG_SHA (ALG_CLASS_HASH|ALG_TYPE_ANY|ALG_SID_SHA) 164 | #define HP_ALGID 1 165 | #define HP_HASHVAL 2 166 | #define HP_HASHSIZE 4 167 | #define CRYPT_EXPORTABLE 0x00000001 168 | #define PROV_RSA_FULL 1 169 | #define PROV_DSS 3 170 | #define MS_DEF_PROV "Microsoft Base Cryptographic Provider v1.0" 171 | #define MS_ENHANCED_PROV "Microsoft Enhanced Cryptographic Provider v1.0" 172 | #define MS_DEF_DSS_PROV "Microsoft Base DSS Cryptographic Provider" 173 | #define CUR_BLOB_VERSION 0x02 174 | #define SIMPLEBLOB 0x1 175 | #define PUBLICKEYBLOB 0x6 176 | #define PRIVATEKEYBLOB 0x7 177 | #define CRYPT_NEWKEYSET 0x00000008 178 | #define CRYPT_DELETEKEYSET 0x00000010 179 | #define CRYPT_MACHINE_KEYSET 0x00000020 180 | #define AT_KEYEXCHANGE 1 181 | #define AT_SIGNATURE 2 182 | #define KP_EFFECTIVE_KEYLEN 19 // for CryptSetKeyParam 183 | #ifndef NTE_BAD_KEY 184 | #define NTE_BAD_KEY 0x80090003L 185 | #endif 186 | 187 | typedef struct _CRYPTOAPI_BLOB { 188 | DWORD cbData; 189 | BYTE *pbData; 190 | } DATA_BLOB, *PDATA_BLOB; 191 | 192 | #endif 193 | 194 | #ifndef CRYPTPROTECT_VERIFY_PROTECTION 195 | typedef struct _CRYPTPROTECT_PROMPTSTRUCT { 196 | DWORD cbSize; 197 | DWORD dwPromptFlags; 198 | HWND hwndApp; 199 | LPCWSTR szPrompt; 200 | } CRYPTPROTECT_PROMPTSTRUCT, *PCRYPTPROTECT_PROMPTSTRUCT; 201 | 202 | #define CRYPTPROTECT_UI_FORBIDDEN 0x1 203 | #define CRYPTPROTECT_LOCAL_MACHINE 0x4 204 | #define CRYPTPROTECT_CRED_SYNC 0x8 205 | #define CRYPTPROTECT_AUDIT 0x10 206 | #define CRYPTPROTECT_VERIFY_PROTECTION 0x40 207 | #endif 208 | 209 | extern BOOL (WINAPI *pCryptAcquireContext)(HCRYPTPROV *, LPCSTR, LPCSTR, DWORD, DWORD); 210 | extern BOOL (WINAPI *pCryptDestroyKey)(HCRYPTKEY); 211 | extern BOOL (WINAPI *pCryptGetKeyParam)(HCRYPTKEY, DWORD, BYTE *, DWORD *, DWORD); 212 | extern BOOL (WINAPI *pCryptSetKeyParam)(HCRYPTKEY, DWORD, BYTE *, DWORD); 213 | extern BOOL (WINAPI *pCryptExportKey)(HCRYPTKEY, HCRYPTKEY, DWORD, DWORD, BYTE *, DWORD *); 214 | extern BOOL (WINAPI *pCryptGetUserKey)(HCRYPTPROV, DWORD, HCRYPTKEY *); 215 | extern BOOL (WINAPI *pCryptEncrypt)(HCRYPTKEY, HCRYPTHASH, BOOL, DWORD, BYTE *, DWORD *, DWORD); 216 | extern BOOL (WINAPI *pCryptGenKey)(HCRYPTPROV, ALG_ID, DWORD, HCRYPTKEY *); 217 | extern BOOL (WINAPI *pCryptGenRandom)(HCRYPTPROV, DWORD, BYTE *); 218 | extern BOOL (WINAPI *pCryptImportKey) 219 | (HCRYPTPROV, CONST BYTE *, DWORD, HCRYPTKEY, DWORD, HCRYPTKEY *); 220 | extern BOOL (WINAPI *pCryptDecrypt)(HCRYPTKEY, HCRYPTHASH, BOOL, DWORD, BYTE *, DWORD *); 221 | extern BOOL (WINAPI *pCryptCreateHash)(HCRYPTPROV, ALG_ID, HCRYPTKEY, DWORD, HCRYPTHASH *); 222 | extern BOOL (WINAPI *pCryptHashData)(HCRYPTHASH, BYTE *, DWORD, DWORD); 223 | extern BOOL (WINAPI *pCryptSignHash)(HCRYPTHASH, DWORD, LPCSTR, DWORD, BYTE *, DWORD *); 224 | extern BOOL (WINAPI *pCryptDestroyHash)(HCRYPTHASH); 225 | extern BOOL (WINAPI *pCryptGetHashParam)(HCRYPTHASH, DWORD, BYTE *, DWORD *, DWORD); 226 | extern BOOL (WINAPI *pCryptSetHashParam)(HCRYPTHASH, DWORD, const BYTE *, DWORD); 227 | 228 | extern BOOL (WINAPI *pCryptVerifySignature) 229 | (HCRYPTHASH, CONST BYTE *, DWORD, HCRYPTKEY, LPCSTR, DWORD); 230 | extern BOOL (WINAPI *pCryptReleaseContext)(HCRYPTPROV, DWORD); 231 | extern BOOL (WINAPI *pCryptProtectData) 232 | (DATA_BLOB* pDataIn, LPCWSTR szDataDescr, DATA_BLOB* pOptionalEntropy, 233 | PVOID pvReserved, CRYPTPROTECT_PROMPTSTRUCT* pPromptStruct, DWORD dwFlags, 234 | DATA_BLOB* pDataOut); 235 | extern BOOL (WINAPI *pCryptUnprotectData) 236 | (DATA_BLOB* pDataIn, LPWSTR* ppszDataDescr, DATA_BLOB* pOptionalEntropy, 237 | PVOID pvReserved, CRYPTPROTECT_PROMPTSTRUCT* pPromptStruct, DWORD dwFlags, 238 | DATA_BLOB* pDataOut); 239 | 240 | #define SHA1_SIZE 20 241 | #define MD5_SIZE 16 242 | 243 | 244 | /* NTDLL */ 245 | typedef LONG NTSTATUS, *PNTSTATUS; 246 | 247 | typedef struct _IO_STATUS_BLOCK { 248 | union { 249 | NTSTATUS Status; 250 | PVOID Pointer; 251 | }; 252 | unsigned long *Information; 253 | } IO_STATUS_BLOCK, *PIO_STATUS_BLOCK; 254 | 255 | typedef enum _FILE_INFORMATION_CLASS { 256 | FileDirectoryInformation = 1, 257 | FileFullDirectoryInformation, 258 | FileBothDirectoryInformation, 259 | FileBasicInformation, 260 | FileStandardInformation, 261 | FileInternalInformation, 262 | FileEaInformation, 263 | FileAccessInformation, 264 | FileNameInformation, 265 | FileRenameInformation, 266 | FileLinkInformation, 267 | FileNamesInformation, 268 | FileDispositionInformation, 269 | FilePositionInformation, 270 | FileFullEaInformation, 271 | FileModeInformation, 272 | FileAlignmentInformation, 273 | FileAllInformation, 274 | FileAllocationInformation, 275 | FileEndOfFileInformation, 276 | FileAlternateNameInformation, 277 | FileStreamInformation, 278 | FilePipeInformation, 279 | FilePipeLocalInformation, 280 | FilePipeRemoteInformation, 281 | FileMailslotQueryInformation, 282 | FileMailslotSetInformation, 283 | FileCompressionInformation, 284 | FileObjectIdInformation, 285 | FileCompletionInformation, 286 | FileMoveClusterInformation, 287 | FileQuotaInformation, 288 | FileReparsePointInformation, 289 | FileNetworkOpenInformation, 290 | FileAttributeTagInformation, 291 | FileTrackingInformation, 292 | FileIdBothDirectoryInformation, 293 | FileIdFullDirectoryInformation, 294 | FileValidDataLengthInformation, 295 | FileShortNameInformation, 296 | FileIoCompletionNotificationInformation, 297 | FileIoStatusBlockRangeInformation, 298 | FileIoPriorityHintInformation, 299 | FileSfioReserveInformation, 300 | FileSfioVolumeInformation, 301 | FileHardLinkInformation, 302 | FileProcessIdsUsingFileInformation, 303 | FileNormalizedNameInformation, 304 | FileNetworkPhysicalNameInformation, 305 | FileIdGlobalTxDirectoryInformation, 306 | FileIsRemoteDeviceInformation, 307 | FileAttributeCacheInformation, 308 | FileNumaNodeInformation, 309 | FileStandardLinkInformation, 310 | FileRemoteProtocolInformation, 311 | FileMaximumInformation 312 | } FILE_INFORMATION_CLASS, *PFILE_INFORMATION_CLASS; 313 | 314 | #define BACKUP_SPARSE_BLOCK 0x00000009 315 | 316 | typedef struct _FILE_STREAM_INFORMATION { 317 | ULONG NextEntryOffset; 318 | ULONG StreamNameLength; 319 | LARGE_INTEGER StreamSize; 320 | LARGE_INTEGER StreamAllocationSize; 321 | WCHAR StreamName[1]; 322 | } FILE_STREAM_INFORMATION, *PFILE_STREAM_INFORMATION; 323 | 324 | extern NTSTATUS (WINAPI *pNtQueryInformationFile)(HANDLE FileHandle, 325 | PIO_STATUS_BLOCK IoStatusBlock, PVOID FileInformation, ULONG Length, 326 | FILE_INFORMATION_CLASS FileInformationClass); 327 | 328 | // ListView extended define for VC4 329 | #ifndef LVM_SETEXTENDEDLISTVIEWSTYLE 330 | #define LVM_SETEXTENDEDLISTVIEWSTYLE (LVM_FIRST + 54) 331 | #define LVM_GETEXTENDEDLISTVIEWSTYLE (LVM_FIRST + 55) 332 | #define LVM_SETCOLUMNORDERARRAY (LVM_FIRST + 58) 333 | #define LVM_GETCOLUMNORDERARRAY (LVM_FIRST + 59) 334 | #define LVS_EX_GRIDLINES 0x00000001 335 | #define LVS_EX_HEADERDRAGDROP 0x00000010 336 | #define LVS_EX_FULLROWSELECT 0x00000020 337 | #define LVS_SHOWSELALWAYS 0x0008 338 | #define LVM_GETHEADER 0x101F 339 | #define EM_AUTOURLDETECT (WM_USER + 91) 340 | #endif 341 | 342 | // ListView extended define for VC4 & VC5 343 | #ifndef LVM_SETSELECTIONMARK 344 | #define LVM_SETSELECTIONMARK (LVM_FIRST + 67) 345 | #define LVN_GETINFOTIPW (LVN_FIRST-58) 346 | #endif 347 | 348 | #if _MSC_VER <= 1200 349 | #define LVN_ENDSCROLL (LVN_FIRST-81) 350 | #endif 351 | 352 | u_int MakeHash(const void *data, int size, DWORD iv=0); 353 | 354 | class TDigest { 355 | protected: 356 | HCRYPTPROV hProv; 357 | HCRYPTHASH hHash; 358 | _int64 updateSize; 359 | 360 | public: 361 | enum Type { SHA1, MD5 /*, SHA1_LOCAL */ } type; 362 | 363 | TDigest(); 364 | ~TDigest(); 365 | BOOL Init(Type _type=SHA1); 366 | BOOL Reset(); 367 | BOOL Update(void *data, int size); 368 | BOOL GetVal(void *data); 369 | int GetDigestSize() { return type == MD5 ? MD5_SIZE : SHA1_SIZE; } 370 | void GetEmptyVal(void *data); 371 | }; 372 | 373 | BOOL TLibInit_AdvAPI32(); 374 | BOOL TLibInit_Crypt32(); 375 | BOOL TLibInit_Ntdll(); 376 | BOOL TGenRandom(void *buf, int len); 377 | 378 | #endif 379 | -------------------------------------------------------------------------------- /src/tlib/tapi32u8.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/laurent22/fastcopy/96b6c6b236a53763c3a011aae78d3be6f8bc3c85/src/tlib/tapi32u8.cpp -------------------------------------------------------------------------------- /src/tlib/tapi32u8.h: -------------------------------------------------------------------------------- 1 | /* @(#)Copyright (C) 1996-2010 H.Shirouzu tapi32u8.h Ver0.99 */ 2 | /* ======================================================================== 3 | Project Name : Win32 Lightweight Class Library Test 4 | Module Name : Main Header 5 | Create : 2005-04-10(Sun) 6 | Update : 2010-05-09(Sun) 7 | Copyright : H.Shirouzu 8 | Reference : 9 | ======================================================================== */ 10 | 11 | #ifndef TAPI32U8_H 12 | #define TAPI32U8_H 13 | 14 | struct WIN32_FIND_DATA_U8 { 15 | DWORD dwFileAttributes; 16 | FILETIME ftCreationTime; 17 | FILETIME ftLastAccessTime; 18 | FILETIME ftLastWriteTime; 19 | DWORD nFileSizeHigh; 20 | DWORD nFileSizeLow; 21 | DWORD dwReserved0; 22 | DWORD dwReserved1; 23 | char cFileName[ MAX_PATH_U8 ]; 24 | char cAlternateFileName[ 14 * 3 ]; 25 | }; 26 | 27 | inline int WtoU8(const WCHAR *src, char *dst, int bufsize, int max_len=-1) { 28 | return ::WideCharToMultiByte(CP_UTF8, 0, src, max_len, dst, bufsize, 0, 0); 29 | } 30 | inline int U8toW(const char *src, WCHAR *dst, int bufsize, int max_len=-1) { 31 | return ::MultiByteToWideChar(CP_UTF8, 0, src, max_len, dst, bufsize); 32 | } 33 | inline int WtoS(LPCWSTR src, char *dst, int bufsize, StrMode mode, int max_len=-1) { 34 | return (mode == BY_UTF8) ? WtoU8(src, dst, bufsize, max_len) 35 | : WtoA(src, dst, bufsize, max_len); 36 | } 37 | 38 | WCHAR *U8toW(const char *src, BOOL noStatic=FALSE); 39 | char *WtoU8(const WCHAR *src, BOOL noStatic=FALSE); 40 | char *WtoA(const WCHAR *src, BOOL noStatic=FALSE); 41 | char *AtoU8(const char *src, BOOL noStatic=FALSE); 42 | char *U8toA(const char *src, BOOL noStatic=FALSE); 43 | char *toA(const void *src, BOOL noStatic=FALSE); 44 | WCHAR *toW(const void *src, BOOL noStatic=FALSE); 45 | void *toV(const char *src, BOOL noStatic=FALSE); 46 | void *toV(const WCHAR *src, BOOL noStatic=FALSE); 47 | 48 | // Win32(W) API UTF8 wrapper 49 | BOOL GetMenuStringU8(HMENU hMenu, UINT uItem, char *buf, int bufsize, UINT flags); 50 | DWORD GetModuleFileNameU8(HMODULE hModule, char *buf, DWORD bufsize); 51 | UINT GetDriveTypeU8(const char *path); 52 | 53 | class U8str { 54 | char *s; 55 | public: 56 | U8str(const WCHAR *_s=NULL) { s = _s ? WtoU8(_s, TRUE) : NULL; } 57 | U8str(const char *_s, StrMode mode=BY_UTF8) { 58 | s = _s ? mode == BY_UTF8 ? strdupNew(s) : AtoU8(_s, TRUE) : NULL; 59 | } 60 | U8str(int len) { if (len) { s = new char [len]; *s = 0; } else { s = NULL; } } 61 | ~U8str() { delete [] s; } 62 | operator const char *() { return s; } 63 | char *Buf() { return s; } 64 | }; 65 | 66 | class Wstr { 67 | WCHAR *s; 68 | public: 69 | Wstr(const char *_s, StrMode mode=BY_UTF8) { 70 | s = _s ? mode == BY_UTF8 ? U8toW(_s, TRUE) : AtoW(_s, TRUE) : NULL; 71 | } 72 | Wstr(int len) { if (len) { s = new WCHAR [len]; *s = 0; } else { s = NULL; } } 73 | ~Wstr() { delete [] s; } 74 | operator const WCHAR *() { return s; } 75 | operator const void *() { return s; } // for V() 76 | WCHAR *Buf() { return s; } 77 | }; 78 | 79 | class MBCSstr { 80 | char *s; 81 | public: 82 | MBCSstr(const WCHAR *_s=NULL) { s = _s ? WtoA(_s, TRUE) : NULL; } 83 | MBCSstr(const char *_s, StrMode mode=BY_UTF8) { 84 | s = _s ? mode == BY_UTF8 ? U8toA(_s, TRUE) : strdupNew(s) : NULL; 85 | } 86 | MBCSstr(int len) { if (len) { s = new char [len]; *s = 0; } else { s = NULL; } } 87 | ~MBCSstr() { delete [] s; } 88 | operator const char *() { return s; } 89 | char *Buf() { return s; } 90 | }; 91 | 92 | BOOL IsUTF8(const char *s); 93 | 94 | HWND CreateWindowU8(const char *class_name, const char *window_name, DWORD style, 95 | int x, int y, int width, int height, HWND hParent, HMENU hMenu, HINSTANCE hInst, void *param); 96 | HWND FindWindowU8(const char *class_name, const char *window_name=NULL); 97 | BOOL AppendMenuU8(HMENU hMenu, UINT flags, UINT idItem, const char *item_str); 98 | BOOL InsertMenuU8(HMENU hMenu, UINT idItem, UINT flags, UINT idNewItem, const char *item_str); 99 | BOOL ModifyMenuU8(HMENU hMenu, UINT idItem, UINT flags, UINT idNewItem, const char *item_str); 100 | DWORD GetFileAttributesU8(const char *path); 101 | BOOL SetFileAttributesU8(const char *path, DWORD attr); 102 | 103 | UINT DragQueryFileU8(HDROP hDrop, UINT iFile, char *buf, UINT cb); 104 | void WIN32_FIND_DATA_WtoU8(const WIN32_FIND_DATAW *fdat_w, WIN32_FIND_DATA_U8 *fdat_u8, 105 | BOOL include_fname=TRUE); 106 | HANDLE FindFirstFileU8(const char *path, WIN32_FIND_DATA_U8 *fdat); 107 | BOOL FindNextFileU8(HANDLE hDir, WIN32_FIND_DATA_U8 *fdat); 108 | DWORD GetFullPathNameU8(const char *path, DWORD size, char *buf, char **fname); 109 | HANDLE CreateFileU8(const char *path, DWORD access_flg, DWORD share_flg, 110 | SECURITY_ATTRIBUTES *sa, DWORD create_flg, DWORD attr_flg, HANDLE hTemplate); 111 | BOOL CreateDirectoryU8(const char *path, SECURITY_ATTRIBUTES *lsa); 112 | BOOL DeleteFileU8(const char *path); 113 | BOOL RemoveDirectoryU8(const char *path); 114 | 115 | HINSTANCE ShellExecuteU8(HWND hWnd, LPCSTR op, LPCSTR file, LPSTR params, LPCSTR dir, int nShow); 116 | BOOL ShellExecuteExU8(SHELLEXECUTEINFO *info); 117 | DWORD GetCurrentDirectoryU8(DWORD size, char *dir); 118 | DWORD GetWindowsDirectoryU8(char *dir, DWORD size); 119 | BOOL SetCurrentDirectoryU8(char *dir); 120 | BOOL GetOpenFileNameU8(LPOPENFILENAME ofn); 121 | BOOL GetSaveFileNameU8(LPOPENFILENAME ofn); 122 | BOOL ReadLinkU8(LPCSTR src, LPSTR dest, LPSTR arg); 123 | BOOL PlaySoundU8(const char *path, HMODULE hmod, DWORD flg); 124 | 125 | 126 | #endif 127 | -------------------------------------------------------------------------------- /src/tlib/tapi32v.cpp: -------------------------------------------------------------------------------- 1 | /* @(#)Copyright (C) 1996-2010 H.Shirouzu tapi32v.cpp Ver0.99 */ 2 | /* ======================================================================== 3 | Project Name : Win32 Lightweight Class Library Test 4 | Module Name : Main Header 5 | Create : 2005-04-10(Sun) 6 | Update : 2010-05-09(Sun) 7 | Copyright : H.Shirouzu 8 | Reference : 9 | ======================================================================== */ 10 | 11 | #include "tlib.h" 12 | #include 13 | #include 14 | #include "tapi32ex.h" 15 | #include "tapi32v.h" 16 | 17 | int (WINAPI *GetWindowTextV)(HWND, void *, int); 18 | int (WINAPI *SetWindowTextV)(HWND, const void *); 19 | BOOL (WINAPI *GetWindowTextLengthV)(HWND); 20 | UINT (WINAPI *GetDlgItemTextV)(HWND, int, void *, int); 21 | BOOL (WINAPI *SetDlgItemTextV)(HWND, int, const void *); 22 | BOOL (WINAPI *PostMessageV)(HWND, UINT, WPARAM, LPARAM); 23 | BOOL (WINAPI *SendMessageV)(HWND, UINT, WPARAM, LPARAM); 24 | BOOL (WINAPI *SendDlgItemMessageV)(HWND, int, UINT, WPARAM, LPARAM); 25 | int (WINAPI *MessageBoxV)(HWND, const void *, const void *, UINT); 26 | DWORD (WINAPI *FormatMessageV)(DWORD, const void *, DWORD, DWORD, void *, DWORD, va_list *); 27 | HWND (WINAPI *CreateDialogParamV)(HANDLE, const void *, HWND, DLGPROC, LPARAM); 28 | int (WINAPI *DialogBoxParamV)(HANDLE, const void *, HWND, DLGPROC, LPARAM); 29 | LONG_PTR (WINAPI *GetWindowLongV)(HWND, int); 30 | LONG_PTR (WINAPI *SetWindowLongV)(HWND, int, LONG_PTR); 31 | LRESULT (WINAPI *CallWindowProcV)(WNDPROC, HWND, UINT, WPARAM, LPARAM); 32 | 33 | int (WINAPI *RegisterClassV)(const void *wc); 34 | HWND (WINAPI *FindWindowV)(const void *class_name, const void *window_name); 35 | HWND (WINAPI *CreateWindowExV)(DWORD exStyle, const void *className, const void *title, 36 | DWORD style, int x, int y, int nw, int nh, HWND hParent, HMENU hMenu, HINSTANCE hI, 37 | void *param); 38 | 39 | long (WINAPI *RegCreateKeyExV)(HKEY hKey, const void *subkey, DWORD reserved, 40 | void *class_name, DWORD opt, REGSAM sam, LPSECURITY_ATTRIBUTES *sa, PHKEY pkey, DWORD *dp); 41 | long (WINAPI *RegOpenKeyExV)(HKEY hKey, const void *subkey, DWORD reserved, 42 | REGSAM sam, PHKEY pkey); 43 | long (WINAPI *RegQueryValueExV)(HKEY hKey, const void *subkey, DWORD *reserved, 44 | DWORD *type, BYTE *data, DWORD *size); 45 | long (WINAPI *RegQueryValueV)(HKEY hKey, const void *subkey, void *value, LONG *size); 46 | long (WINAPI *RegSetValueExV)(HKEY hKey, const void *name, DWORD *reserved, 47 | DWORD type, const BYTE *data, DWORD size); 48 | long (WINAPI *RegDeleteKeyV)(HKEY hKey, const void *subkey); 49 | long (WINAPI *RegDeleteValueV)(HKEY hKey, const void *subval); 50 | long (WINAPI *RegEnumKeyExV)(HKEY hKey, DWORD ikey, void *key, DWORD *size, 51 | DWORD *reserved, BYTE *class_name, DWORD *class_size, PFILETIME ft); 52 | long (WINAPI *RegEnumValueV)(HKEY hKey, DWORD iVal, void *val, DWORD *size, 53 | DWORD *reserved, DWORD *type, BYTE *data, DWORD *data_size); 54 | 55 | DWORD (WINAPI *GetFileAttributesV)(const void *path); 56 | BOOL (WINAPI *SetFileAttributesV)(const void *path, DWORD attr); 57 | HANDLE (WINAPI *FindFirstFileV)(const void *path, WIN32_FIND_DATAW *fdat); 58 | BOOL (WINAPI *FindNextFileV)(const void *path, WIN32_FIND_DATAW *fdat); 59 | HANDLE (WINAPI *CreateFileV)(const void *path, DWORD access, DWORD share, 60 | LPSECURITY_ATTRIBUTES sa, DWORD create, DWORD attr, HANDLE ht); 61 | BOOL (WINAPI *MoveFileV)(const void *, const void *); 62 | BOOL (WINAPI *CreateHardLinkV)(const void *, const void *, LPSECURITY_ATTRIBUTES sa); 63 | BOOL (WINAPI *CreateDirectoryV)(const void *path, LPSECURITY_ATTRIBUTES secattr); 64 | BOOL (WINAPI *RemoveDirectoryV)(const void *path); 65 | DWORD (WINAPI *GetCurrentDirectoryV)(DWORD size, void *path); 66 | BOOL (WINAPI *SetCurrentDirectoryV)(const void *path); 67 | BOOL (WINAPI *DeleteFileV)(const void *path); 68 | DWORD (WINAPI *GetModuleFileNameV)(HMODULE hMod, void *path, DWORD len); 69 | DWORD (WINAPI *GetFullPathNameV)(const void *path, DWORD len, void *buf, void **fname); 70 | BOOL (WINAPI *GetDiskFreeSpaceV)(const void *path, DWORD *spc, DWORD *bps, DWORD *fc, 71 | DWORD *cl); 72 | DWORD (WINAPI *GetDriveTypeV)(const void *path); 73 | BOOL (WINAPI *GetVolumeInformationV)(const void *, void *, DWORD, DWORD *, DWORD *, DWORD *, 74 | void *, DWORD); 75 | UINT (WINAPI *DragQueryFileV)(HDROP, UINT, void *, UINT); 76 | BOOL (WINAPI *GetOpenFileNameV)(LPOPENFILENAMEW); 77 | BOOL (WINAPI *GetSaveFileNameV)(LPOPENFILENAMEW); 78 | BOOL (WINAPI *InsertMenuV)(HMENU, UINT, UINT, UINT, const void *); 79 | BOOL (WINAPI *ModifyMenuV)(HMENU, UINT, UINT, UINT, const void *); 80 | 81 | BOOL (WINAPI *GetMonitorInfoV)(HMONITOR hMonitor, MONITORINFO *lpmi); 82 | HMONITOR (WINAPI *MonitorFromPointV)(POINT pt, DWORD dwFlags); 83 | 84 | BOOL (WINAPI *SHGetPathFromIDListV)(LPCITEMIDLIST, void *); 85 | LPITEMIDLIST (WINAPI *SHBrowseForFolderV)(BROWSEINFO *); 86 | LPITEMIDLIST (WINAPI *ILCreateFromPathV)(void *); 87 | void (WINAPI *ILFreeV)(LPITEMIDLIST); 88 | GUID IID_IShellLinkV; 89 | HINSTANCE (WINAPI *ShellExecuteV)(HWND hWnd, const void*, const void*, void*, const void*, int); 90 | BOOL (WINAPI *ShellExecuteExV)(LPSHELLEXECUTEINFO); 91 | HMODULE (WINAPI *LoadLibraryV)(void *); 92 | BOOL (WINAPI *PlaySoundV)(const void *, HMODULE, DWORD); 93 | 94 | void *(WINAPI *GetCommandLineV)(void); 95 | void *(WINAPI *CharUpperV)(void *str); 96 | void *(WINAPI *CharLowerV)(void *str); 97 | int (WINAPI *lstrcmpiV)(const void *str1, const void *str2); 98 | int (WINAPI *lstrlenV)(const void *str); 99 | void *(*lstrchrV)(const void *str, int); 100 | WCHAR (*lGetCharV)(const void *, int); 101 | void (*lSetCharV)(void *, int, WCHAR ch); 102 | WCHAR (*lGetCharIncV)(const void **); 103 | int (*strcmpV)(const void *str1, const void *str2); // static ... for qsort 104 | int (*strnicmpV)(const void *str1, const void *str2, int len); 105 | int (*strlenV)(const void *path); 106 | void *(*strcpyV)(void *dst, const void *src); 107 | void *(*strdupV)(const void *src); 108 | void *(*strchrV)(const void *src, int); 109 | void *(*strrchrV)(const void *src, int); 110 | long (*strtolV)(const void *, const void **, int base); 111 | u_long (*strtoulV)(const void *, const void **, int base); 112 | int (*sprintfV)(void *buf, const void *format,...); 113 | int (*MakePathV)(void *dest, const void *dir, const void *file); 114 | 115 | void *ASTERISK_V; // "*" 116 | void *FMT_CAT_ASTER_V; // "%s\\*" 117 | void *FMT_STR_V; // "%s" 118 | void *FMT_QUOTE_STR_V; // "\"%s\"" 119 | void *FMT_INT_STR_V; // "%d" 120 | void *BACK_SLASH_V; // "\\" 121 | void *SEMICOLON_V; // ";" 122 | void *SEMICLN_SPC_V; // "; " 123 | void *NEWLINE_STR_V; // "\r\n" 124 | void *EMPTY_STR_V; // "" 125 | void *DOT_V; // "." 126 | void *DOTDOT_V; // ".." 127 | void *QUOTE_V; // "\"" 128 | void *TRUE_V; // "true" 129 | void *FALSE_V; // "false" 130 | int CHAR_LEN_V; // 2(WCHAR) or 1(char) 131 | int MAX_PATHLEN_V; // MAX_WCHAR or 132 | BOOL IS_WINNT_V; // MAX_WCHAR or 133 | DWORD SHCNF_PATHV = SHCNF_PATHW; 134 | 135 | DEFINE_GUID(IID_IShellLinkW, 0x000214F9, 0x0000, 0000, 0xC0, 0x00, 0x00, 0x00, 0x00, \ 136 | 0x00, 0x00, 0x46); 137 | DEFINE_GUID(IID_IShellLinkA, 0x000214EE, 0x0000, 0000, 0xC0, 0x00, 0x00, 0x00, 0x00, \ 138 | 0x00, 0x00, 0x46); 139 | 140 | void *GetLoadStrV(UINT resId, HINSTANCE hI) 141 | { 142 | if (IS_WINNT_V) 143 | return GetLoadStrW(resId, hI); 144 | else 145 | return GetLoadStrA(resId, hI); 146 | } 147 | 148 | BOOL TLibInit_Win32V() 149 | { 150 | if (IS_WINNT_V = IsWinNT()) { 151 | // Win32API(UNICODE) 152 | GetWindowTextV = (int (WINAPI *)(HWND, void *, int))GetWindowTextW; 153 | SetWindowTextV = (int (WINAPI *)(HWND, const void *))SetWindowTextW; 154 | GetWindowTextLengthV = (BOOL (WINAPI *)(HWND))GetWindowTextLengthW; 155 | 156 | GetDlgItemTextV = (UINT (WINAPI *)(HWND, int, void *, int))GetDlgItemTextW; 157 | SetDlgItemTextV = (BOOL (WINAPI *)(HWND, int, const void *))SetDlgItemTextW; 158 | PostMessageV = (BOOL (WINAPI *)(HWND, UINT, WPARAM, LPARAM))PostMessageW; 159 | SendMessageV = (BOOL (WINAPI *)(HWND, UINT, WPARAM, LPARAM))SendMessageW; 160 | SendDlgItemMessageV = (BOOL (WINAPI *)(HWND, int, UINT, WPARAM, LPARAM)) 161 | SendDlgItemMessageW; 162 | MessageBoxV = (int (WINAPI *)(HWND, const void *, const void *, UINT))MessageBoxW; 163 | FormatMessageV = (DWORD (WINAPI *)(DWORD, const void *, DWORD, DWORD, void *, DWORD, 164 | va_list *))FormatMessageW; 165 | CreateDialogParamV = (HWND (WINAPI *)(HANDLE, const void *, HWND, DLGPROC, LPARAM)) 166 | CreateDialogParamW; 167 | DialogBoxParamV = (int (WINAPI *)(HANDLE, const void *, HWND, DLGPROC, LPARAM)) 168 | DialogBoxParamW; 169 | GetWindowLongV = (LONG_PTR (WINAPI *)(HWND, int))GetWindowLongW; 170 | SetWindowLongV = (LONG_PTR (WINAPI *)(HWND, int, LONG_PTR))SetWindowLongW; 171 | CallWindowProcV = (LRESULT (WINAPI *)(WNDPROC, HWND, UINT, WPARAM, LPARAM)) 172 | CallWindowProcW; 173 | RegisterClassV = (int (WINAPI *)(const void *))RegisterClassW; 174 | FindWindowV = (HWND (WINAPI *)(const void *, const void *))FindWindowW; 175 | CreateWindowExV = (HWND (WINAPI *)(DWORD, const void *, const void *, DWORD, 176 | int, int, int, int, HWND, HMENU, HINSTANCE, void *))CreateWindowExW; 177 | 178 | RegCreateKeyExV = (long (WINAPI *)(HKEY, const void *, DWORD, void *, DWORD, REGSAM, 179 | LPSECURITY_ATTRIBUTES *, PHKEY, DWORD *))RegCreateKeyExW; 180 | RegOpenKeyExV = (long (WINAPI *)(HKEY, const void *, DWORD, REGSAM, PHKEY))RegOpenKeyExW; 181 | RegQueryValueExV = (long (WINAPI *)(HKEY, const void *, DWORD *, DWORD *, BYTE *, DWORD*)) 182 | RegQueryValueExW; 183 | RegQueryValueV = (long (WINAPI *)(HKEY, const void *, void *, LONG *))RegQueryValueW; 184 | RegSetValueExV = (long (WINAPI *)(HKEY, const void *, DWORD *, DWORD, const BYTE *,DWORD)) 185 | RegSetValueExW; 186 | RegDeleteKeyV = (long (WINAPI *)(HKEY, const void *))RegDeleteKeyW; 187 | RegDeleteValueV = (long (WINAPI *)(HKEY, const void *))RegDeleteValueW; 188 | RegEnumKeyExV = (long (WINAPI *)(HKEY, DWORD, void *, DWORD *, DWORD *, BYTE *, DWORD *, 189 | PFILETIME))RegEnumKeyExW; 190 | RegEnumValueV = (long (WINAPI *)(HKEY, DWORD, void *, DWORD *, DWORD *, DWORD *, BYTE *, 191 | DWORD *))RegEnumValueW; 192 | 193 | GetFileAttributesV = (DWORD (WINAPI *)(const void *))::GetFileAttributesW; 194 | SetFileAttributesV = (BOOL (WINAPI *)(const void *, DWORD))::SetFileAttributesW; 195 | FindFirstFileV = (HANDLE (WINAPI *)(const void *, WIN32_FIND_DATAW *))::FindFirstFileW; 196 | FindNextFileV = (BOOL (WINAPI *)(const void *, WIN32_FIND_DATAW *))::FindNextFileW; 197 | CreateFileV = (HANDLE (WINAPI *)(const void *, DWORD, DWORD, LPSECURITY_ATTRIBUTES, 198 | DWORD, DWORD, HANDLE))::CreateFileW; 199 | MoveFileV = (BOOL (WINAPI *)(const void *, const void *))::MoveFileW; 200 | 201 | HMODULE hKernel32 = ::GetModuleHandle("kernel32.dll"); 202 | CreateHardLinkV = (BOOL (WINAPI *)(const void *, const void *, LPSECURITY_ATTRIBUTES sa)) 203 | ::GetProcAddress(hKernel32, "CreateHardLinkW"); 204 | 205 | CreateDirectoryV = (BOOL (WINAPI *)(const void *, LPSECURITY_ATTRIBUTES)) 206 | ::CreateDirectoryW; 207 | RemoveDirectoryV = (BOOL (WINAPI *)(const void *))::RemoveDirectoryW; 208 | DeleteFileV = (BOOL (WINAPI *)(const void *))::DeleteFileW; 209 | GetCurrentDirectoryV = (DWORD (WINAPI *)(DWORD, void *))::GetCurrentDirectoryW; 210 | SetCurrentDirectoryV = (BOOL (WINAPI *)(const void *))::SetCurrentDirectoryW; 211 | GetModuleFileNameV = (DWORD (WINAPI *)(HMODULE, void *, DWORD)) 212 | GetModuleFileNameW; 213 | GetFullPathNameV = (DWORD (WINAPI *)(const void *, DWORD, void *, void **)) 214 | GetFullPathNameW; 215 | GetDiskFreeSpaceV = (BOOL (WINAPI *)(const void *, DWORD *, DWORD *, DWORD *, DWORD *)) 216 | ::GetDiskFreeSpaceW; 217 | GetDriveTypeV = (DWORD (WINAPI *)(const void *))::GetDriveTypeW; 218 | GetVolumeInformationV = (BOOL (WINAPI *)(const void *, void *, DWORD, DWORD *, DWORD *, 219 | DWORD *, void *, DWORD))::GetVolumeInformationW; 220 | DragQueryFileV = (UINT (WINAPI *)(HDROP, UINT, void *, UINT))DragQueryFileW; 221 | GetOpenFileNameV = (BOOL (WINAPI *)(LPOPENFILENAMEW))GetOpenFileNameW; 222 | GetSaveFileNameV = (BOOL (WINAPI *)(LPOPENFILENAMEW))GetSaveFileNameW; 223 | InsertMenuV = (BOOL (WINAPI *)(HMENU, UINT, UINT, UINT, const void *))InsertMenuW; 224 | ModifyMenuV = (BOOL (WINAPI *)(HMENU, UINT, UINT, UINT, const void *))ModifyMenuW; 225 | GetCommandLineV = (void *(WINAPI *)(void))GetCommandLineW; 226 | ShellExecuteV = (HINSTANCE (WINAPI *)(HWND hWnd, const void *, const void *, void *, 227 | const void *, int))ShellExecuteW; 228 | ShellExecuteExV = (BOOL (WINAPI *)(LPSHELLEXECUTEINFO))ShellExecuteExW; 229 | LoadLibraryV = (HMODULE (WINAPI *)(void *))LoadLibraryW; 230 | PlaySoundV = (BOOL (WINAPI *)(const void *, HMODULE, DWORD))PlaySoundW; 231 | 232 | CharUpperV = (void *(WINAPI *)(void *))::CharUpperW; 233 | CharLowerV = (void *(WINAPI *)(void *))::CharLowerW; 234 | lstrcmpiV = (int (WINAPI *)(const void *, const void *))::lstrcmpiW; 235 | lstrlenV = (int (WINAPI *)(const void *))::lstrlenW; 236 | lstrchrV = (void *(*)(const void *, int))(const wchar_t *(*)(const wchar_t *, wchar_t)) 237 | ::wcschr; 238 | lGetCharV = (WCHAR (*)(const void *, int))::lGetCharW; 239 | lSetCharV = (void (*)(void *, int, WCHAR))::lSetCharW; 240 | lGetCharIncV = (WCHAR (*)(const void **))::lGetCharIncW; 241 | strcmpV = (int (*)(const void *, const void *))::wcscmp; 242 | strnicmpV = (int (*)(const void *, const void *, int))::_wcsnicmp; 243 | strlenV = (int (*)(const void *))::wcslen; 244 | strcpyV = (void *(*)(void *, const void *))::wcscpy; 245 | strdupV = (void *(*)(const void *))::wcsdup; 246 | strchrV = (void *(*)(const void *, int))(const wchar_t *(*)(const wchar_t *, wchar_t)) 247 | ::wcschr; 248 | strrchrV = (void *(*)(const void *, int))(const wchar_t *(*)(const wchar_t *, wchar_t)) 249 | ::wcsrchr; 250 | strtolV = (long (*)(const void *, const void **, int base))::wcstol; 251 | strtoulV = (u_long (*)(const void *, const void **, int base))::wcstoul; 252 | sprintfV = (int (*)(void *, const void *,...))(int (*)(wchar_t *, const wchar_t *,...)) 253 | ::swprintf; 254 | MakePathV = (int (*)(void *, const void *, const void *))::MakePathW; 255 | 256 | HMODULE hShell32 = ::GetModuleHandle("shell32.dll"); 257 | SHGetPathFromIDListV = (BOOL (WINAPI *)(LPCITEMIDLIST, void *)) 258 | ::GetProcAddress(hShell32, "SHGetPathFromIDListW"); 259 | SHBrowseForFolderV = (LPITEMIDLIST (WINAPI *)(BROWSEINFO *)) 260 | ::GetProcAddress(hShell32, "SHBrowseForFolderW"); 261 | ILCreateFromPathV = (LPITEMIDLIST (WINAPI *)(void *)) 262 | ::GetProcAddress(hShell32, "ILCreateFromPathW"); 263 | ILFreeV = (void (WINAPI *)(LPITEMIDLIST))::GetProcAddress(hShell32, "ILFree"); 264 | IID_IShellLinkV = IID_IShellLinkW; 265 | 266 | HMODULE hUser32 = ::GetModuleHandle("user32.dll"); 267 | GetMonitorInfoV = (BOOL (WINAPI *)(HMONITOR, MONITORINFO *)) 268 | ::GetProcAddress(hUser32, "GetMonitorInfoW"); 269 | MonitorFromPointV = (HMONITOR (WINAPI *)(POINT, DWORD)) 270 | ::GetProcAddress(hUser32, "MonitorFromPoint"); 271 | 272 | CHAR_LEN_V = sizeof(WCHAR); 273 | MAX_PATHLEN_V = MAX_WPATH; 274 | SHCNF_PATHV = SHCNF_PATHW; 275 | 276 | ASTERISK_V = L"*"; 277 | FMT_CAT_ASTER_V = L"%s\\*"; 278 | FMT_STR_V = L"%s"; 279 | FMT_QUOTE_STR_V = L"\"%s\""; 280 | BACK_SLASH_V = L"\\"; 281 | SEMICOLON_V = L";"; 282 | SEMICLN_SPC_V = L"; "; 283 | NEWLINE_STR_V = L"\r\n"; 284 | EMPTY_STR_V = L""; 285 | DOT_V = L"."; 286 | DOTDOT_V = L".."; 287 | QUOTE_V = L"\""; 288 | TRUE_V = L"true"; 289 | FALSE_V = L"false"; 290 | } 291 | else { 292 | // Win32API(ANSI) 293 | GetWindowTextV = (int (WINAPI *)(HWND, void *, int))GetWindowTextA; 294 | SetWindowTextV = (int (WINAPI *)(HWND, const void *))SetWindowTextA; 295 | GetWindowTextLengthV = (BOOL (WINAPI *)(HWND))GetWindowTextLengthA; 296 | 297 | GetDlgItemTextV = (UINT (WINAPI *)(HWND, int, void *, int))GetDlgItemTextA; 298 | SetDlgItemTextV = (BOOL (WINAPI *)(HWND, int, const void *))SetDlgItemTextA; 299 | PostMessageV = (BOOL (WINAPI *)(HWND, UINT, WPARAM, LPARAM))PostMessageA; 300 | SendMessageV = (BOOL (WINAPI *)(HWND, UINT, WPARAM, LPARAM))SendMessageA; 301 | SendDlgItemMessageV = (BOOL (WINAPI *)(HWND, int, UINT, WPARAM, LPARAM)) 302 | SendDlgItemMessageA; 303 | MessageBoxV = (int (WINAPI *)(HWND, const void *, const void *, UINT))MessageBoxA; 304 | FormatMessageV = (DWORD (WINAPI *)(DWORD, const void *, DWORD, DWORD, void *, DWORD, 305 | va_list *))FormatMessageA; 306 | CreateDialogParamV = (HWND (WINAPI *)(HANDLE, const void *, HWND, DLGPROC, LPARAM)) 307 | CreateDialogParamA; 308 | DialogBoxParamV = (int (WINAPI *)(HANDLE, const void *, HWND, DLGPROC, LPARAM)) 309 | DialogBoxParamA; 310 | GetWindowLongV = (LONG_PTR (WINAPI *)(HWND, int))GetWindowLongA; 311 | SetWindowLongV = (LONG_PTR (WINAPI *)(HWND, int, LONG_PTR))SetWindowLongA; 312 | CallWindowProcV = (LRESULT (WINAPI *)(WNDPROC, HWND, UINT, WPARAM, LPARAM)) 313 | CallWindowProcA; 314 | 315 | RegisterClassV = (int (WINAPI *)(const void *))RegisterClassA; 316 | FindWindowV = (HWND (WINAPI *)(const void *, const void *))FindWindowA; 317 | CreateWindowExV = (HWND (WINAPI *)(DWORD, const void *, const void *, DWORD, 318 | int, int, int, int, HWND, HMENU, HINSTANCE, void *))CreateWindowExA; 319 | 320 | RegCreateKeyExV = (long (WINAPI *)(HKEY, const void *, DWORD, void *, DWORD, 321 | REGSAM, LPSECURITY_ATTRIBUTES *, PHKEY, DWORD *))RegCreateKeyExA; 322 | RegOpenKeyExV = (long (WINAPI *)(HKEY, const void *, DWORD, REGSAM, PHKEY)) 323 | RegOpenKeyExA; 324 | RegQueryValueExV = (long (WINAPI *)(HKEY, const void *, DWORD *, DWORD *, BYTE *, DWORD*)) 325 | RegQueryValueExA; 326 | RegQueryValueV = (long (WINAPI *)(HKEY, const void *, void *, LONG *))RegQueryValueA; 327 | RegSetValueExV = (long (WINAPI *)(HKEY, const void *, DWORD *, DWORD, const BYTE*, DWORD)) 328 | RegSetValueExA; 329 | RegDeleteKeyV = (long (WINAPI *)(HKEY, const void *))RegDeleteKeyA; 330 | RegDeleteValueV = (long (WINAPI *)(HKEY, const void *))RegDeleteValueA; 331 | RegEnumKeyExV = (long (WINAPI *)(HKEY, DWORD, void *, DWORD *, DWORD *, BYTE *, DWORD *, 332 | PFILETIME))RegEnumKeyExA; 333 | RegEnumValueV = (long (WINAPI *)(HKEY, DWORD, void *, DWORD *, DWORD *, DWORD *, BYTE *, 334 | DWORD *))RegEnumValueA; 335 | 336 | GetFileAttributesV = (DWORD (WINAPI *)(const void *))::GetFileAttributesA; 337 | SetFileAttributesV = (BOOL (WINAPI *)(const void *, DWORD))::SetFileAttributesA; 338 | FindFirstFileV = (HANDLE (WINAPI *)(const void *, WIN32_FIND_DATAW *))::FindFirstFileA; 339 | FindNextFileV = (BOOL (WINAPI *)(const void *, WIN32_FIND_DATAW *))::FindNextFileA; 340 | CreateFileV = (HANDLE (WINAPI *)(const void *, DWORD, DWORD, LPSECURITY_ATTRIBUTES, 341 | DWORD, DWORD, HANDLE))::CreateFileA; 342 | MoveFileV = (BOOL (WINAPI *)(const void *, const void *))::MoveFileA; 343 | 344 | HMODULE hKernel32 = ::GetModuleHandle("kernel32.dll"); 345 | CreateHardLinkV = (BOOL (WINAPI *)(const void *, const void *, LPSECURITY_ATTRIBUTES sa)) 346 | ::GetProcAddress(hKernel32, "CreateHardLinkA"); 347 | 348 | CreateDirectoryV = (BOOL (WINAPI *)(const void *, LPSECURITY_ATTRIBUTES)) 349 | ::CreateDirectoryA; 350 | RemoveDirectoryV = (BOOL (WINAPI *)(const void *))::RemoveDirectoryA; 351 | DeleteFileV = (BOOL (WINAPI *)(const void *))::DeleteFileA; 352 | GetCurrentDirectoryV = (DWORD (WINAPI *)(DWORD, void *))::GetCurrentDirectoryA; 353 | SetCurrentDirectoryV = (BOOL (WINAPI *)(const void *))::SetCurrentDirectoryA; 354 | GetModuleFileNameV = (DWORD (WINAPI *)(HMODULE, void *, DWORD)) 355 | GetModuleFileNameA; 356 | GetFullPathNameV = (DWORD (WINAPI *)(const void *, DWORD, void *, void **)) 357 | ::GetFullPathNameA; 358 | GetDiskFreeSpaceV = (BOOL (WINAPI *)(const void *, DWORD *, DWORD *, DWORD *, DWORD *)) 359 | ::GetDiskFreeSpaceA; 360 | GetDriveTypeV = (DWORD (WINAPI *)(const void *))::GetDriveTypeA; 361 | GetVolumeInformationV = (BOOL (WINAPI *)(const void *, void *, DWORD, DWORD *, DWORD *, 362 | DWORD *, void *, DWORD))::GetVolumeInformationA; 363 | DragQueryFileV = (UINT (WINAPI *)(HDROP, UINT, void *, UINT))DragQueryFileA; 364 | GetOpenFileNameV = (BOOL (WINAPI *)(LPOPENFILENAMEW))GetOpenFileNameA; 365 | GetSaveFileNameV = (BOOL (WINAPI *)(LPOPENFILENAMEW))GetSaveFileNameA; 366 | InsertMenuV = (BOOL (WINAPI *)(HMENU, UINT, UINT, UINT, const void *))InsertMenuA; 367 | ModifyMenuV = (BOOL (WINAPI *)(HMENU, UINT, UINT, UINT, const void *))ModifyMenuA; 368 | GetCommandLineV = (void *(WINAPI *)(void))GetCommandLineA; 369 | ShellExecuteV = (HINSTANCE (WINAPI *)(HWND hWnd, const void *, const void *, void *, 370 | const void *, int))ShellExecuteA; 371 | ShellExecuteExV = (BOOL (WINAPI *)(LPSHELLEXECUTEINFO))ShellExecuteExA; 372 | LoadLibraryV = (HMODULE (WINAPI *)(void *))LoadLibraryA; 373 | PlaySoundV = (BOOL (WINAPI *)(const void *, HMODULE, DWORD))PlaySoundA; 374 | 375 | CharUpperV = (void *(WINAPI *)(void *))::CharUpperA; 376 | CharLowerV = (void *(WINAPI *)(void *))::CharLowerA; 377 | lstrcmpiV = (int (WINAPI *)(const void *, const void *))::lstrcmpiA; 378 | lstrlenV = (int (WINAPI *)(const void *))::lstrlenA; 379 | lstrchrV = (void *(*)(const void *, int))(u_char *(*)(u_char *, u_int))::_mbschr; 380 | lGetCharV = (WCHAR (*)(const void *, int))::lGetCharA; 381 | lSetCharV = (void (*)(void *, int, WCHAR))::lSetCharA; 382 | lGetCharIncV = (WCHAR (*)(const void **))::lGetCharIncA; 383 | strcmpV = (int (*)(const void *, const void *))::strcmp; 384 | strnicmpV = (int (*)(const void *, const void *, int))::strnicmp; 385 | strlenV = (int (*)(const void *))::strlen; 386 | strcpyV = (void *(*)(void *, const void *))::strcpy; 387 | strdupV = (void *(*)(const void *))::strdup; 388 | strchrV = (void *(*)(const void *, int))(char *(*)(char *, int))::strchr; 389 | strrchrV = (void *(*)(const void *, int))(char *(*)(char *, int))::strrchr; 390 | strtolV = (long (*)(const void *, const void **, int base))::strtol; 391 | strtoulV = (u_long (*)(const void *, const void **, int base))::strtoul; 392 | sprintfV = (int (*)(void *, const void *,...))::sprintf; 393 | MakePathV = (int (*)(void *, const void *, const void *))::MakePath; 394 | 395 | SHGetPathFromIDListV = (BOOL (WINAPI *)(LPCITEMIDLIST, void *))SHGetPathFromIDList; 396 | SHBrowseForFolderV = (LPITEMIDLIST (WINAPI *)(BROWSEINFO *))SHBrowseForFolder; 397 | ILCreateFromPathV = (LPITEMIDLIST (WINAPI *)(void *))NULL; 398 | ILFreeV = (void (WINAPI *)(LPITEMIDLIST))NULL; 399 | IID_IShellLinkV = IID_IShellLinkA; 400 | 401 | HMODULE hUser32 = ::GetModuleHandle("user32.dll"); 402 | GetMonitorInfoV = (BOOL (WINAPI *)(HMONITOR, MONITORINFO *)) 403 | ::GetProcAddress(hUser32, "GetMonitorInfoA"); 404 | MonitorFromPointV = (HMONITOR (WINAPI *)(POINT, DWORD)) 405 | ::GetProcAddress(hUser32, "MonitorFromPoint"); 406 | 407 | MAX_PATHLEN_V = MAX_PATH_EX; 408 | CHAR_LEN_V = sizeof(char); 409 | SHCNF_PATHV = SHCNF_PATH; 410 | 411 | ASTERISK_V = "*"; 412 | FMT_CAT_ASTER_V = "%s\\*"; 413 | FMT_STR_V = "%s"; 414 | FMT_QUOTE_STR_V = "\"%s\""; 415 | BACK_SLASH_V = "\\"; 416 | SEMICOLON_V = ";"; 417 | SEMICLN_SPC_V = "; "; 418 | NEWLINE_STR_V = "\r\n"; 419 | EMPTY_STR_V = ""; 420 | DOT_V = "."; 421 | DOTDOT_V = ".."; 422 | QUOTE_V = "\""; 423 | TRUE_V = "true"; 424 | FALSE_V = "false"; 425 | } 426 | return TRUE; 427 | } 428 | 429 | -------------------------------------------------------------------------------- /src/tlib/tapi32v.h: -------------------------------------------------------------------------------- 1 | /* @(#)Copyright (C) 1996-2010 H.Shirouzu tapi32v.h Ver0.99 */ 2 | /* ======================================================================== 3 | Project Name : Win32 Lightweight Class Library Test 4 | Module Name : Main Header 5 | Create : 2005-04-10(Sun) 6 | Update : 2010-05-09(Sun) 7 | Copyright : H.Shirouzu 8 | Reference : 9 | ======================================================================== */ 10 | 11 | #ifndef TAPI32V_H 12 | #define TAPI32V_H 13 | 14 | extern int (WINAPI *RegisterClassV)(const void *wc); 15 | extern HWND (WINAPI *FindWindowV)(const void *class_name, const void *window_name); 16 | extern HWND (WINAPI *CreateWindowExV)(DWORD exStyle, const void *className, const void *title, 17 | DWORD style, int x, int y, int nw, int nh, HWND hParent, HMENU hMenu, HINSTANCE hI, 18 | void *param); 19 | 20 | extern long (WINAPI *RegCreateKeyExV)(HKEY hKey, const void *subkey, DWORD reserved, 21 | void *class_name, DWORD opt, REGSAM sam, LPSECURITY_ATTRIBUTES *sa, PHKEY pkey, DWORD *dp); 22 | extern long (WINAPI *RegOpenKeyExV)(HKEY hKey, const void *subkey, DWORD reserved, REGSAM sam, 23 | PHKEY pkey); 24 | extern long (WINAPI *RegQueryValueExV)(HKEY hKey, const void *subkey, DWORD *reserved, 25 | DWORD *type, BYTE *data, DWORD *size); 26 | extern long (WINAPI *RegQueryValueV)(HKEY hKey, const void *subkey, void *value, LONG *size); 27 | extern long (WINAPI *RegSetValueExV)(HKEY hKey, const void *name, DWORD *reserved, 28 | DWORD type, const BYTE *data, DWORD size); 29 | extern long (WINAPI *RegDeleteKeyV)(HKEY hKey, const void *subkey); 30 | extern long (WINAPI *RegDeleteValueV)(HKEY hKey, const void *subval); 31 | extern long (WINAPI *RegEnumKeyExV)(HKEY hKey, DWORD ikey, void *key, DWORD *size, 32 | DWORD *reserved, BYTE *class_name, DWORD *class_size, PFILETIME ft); 33 | extern long (WINAPI *RegEnumValueV)(HKEY hKey, DWORD iVal, void *val, DWORD *size, 34 | DWORD *reserved, DWORD *type, BYTE *data, DWORD *data_size); 35 | 36 | extern int (WINAPI *GetWindowTextV)(HWND, void *, int); 37 | extern int (WINAPI *SetWindowTextV)(HWND, const void *); 38 | extern BOOL (WINAPI *GetWindowTextLengthV)(HWND); 39 | extern UINT (WINAPI *GetDlgItemTextV)(HWND, int, void *, int); 40 | extern BOOL (WINAPI *SetDlgItemTextV)(HWND, int, const void *); 41 | extern BOOL (WINAPI *PostMessageV)(HWND, UINT, WPARAM, LPARAM); 42 | extern BOOL (WINAPI *SendMessageV)(HWND, UINT, WPARAM, LPARAM); 43 | extern BOOL (WINAPI *SendDlgItemMessageV)(HWND, int, UINT, WPARAM, LPARAM); 44 | extern int (WINAPI *MessageBoxV)(HWND, const void *, const void *, UINT); 45 | extern DWORD (WINAPI *FormatMessageV)(DWORD, const void *, DWORD, DWORD, void *, DWORD, va_list*); 46 | extern HWND (WINAPI *CreateDialogParamV)(HANDLE, const void *, HWND, DLGPROC, LPARAM); 47 | extern int (WINAPI *DialogBoxParamV)(HANDLE, const void *, HWND, DLGPROC, LPARAM); 48 | extern LONG_PTR (WINAPI *GetWindowLongV)(HWND, int); 49 | extern LONG_PTR (WINAPI *SetWindowLongV)(HWND, int, LONG_PTR); 50 | extern LRESULT (WINAPI *CallWindowProcV)(WNDPROC, HWND, UINT, WPARAM, LPARAM); 51 | 52 | #define CreateDialogV(hInstance, lpTemplate, hWndParent, lpDialogFunc) \ 53 | CreateDialogParamV(hInstance, lpTemplate, hWndParent, lpDialogFunc, 0L) 54 | #define DialogBoxV(hInstance, lpTemplate, hWndParent, lpDialogFunc) \ 55 | DialogBoxParamV(hInstance, lpTemplate, hWndParent, lpDialogFunc, 0L) 56 | 57 | extern DWORD (WINAPI *GetFileAttributesV)(const void *path); 58 | extern BOOL (WINAPI *SetFileAttributesV)(const void *path, DWORD attr); 59 | extern HANDLE (WINAPI *FindFirstFileV)(const void *path, WIN32_FIND_DATAW *fdat); 60 | extern BOOL (WINAPI *FindNextFileV)(const void *path, WIN32_FIND_DATAW *fdat); 61 | extern HANDLE (WINAPI *CreateFileV)(const void *path, DWORD access, DWORD share, 62 | LPSECURITY_ATTRIBUTES sa, DWORD create, DWORD attr, HANDLE ht); 63 | extern BOOL (WINAPI *CreateHardLinkV)(const void *, const void *, LPSECURITY_ATTRIBUTES sa); 64 | extern BOOL (WINAPI *MoveFileV)(const void *, const void *); 65 | extern BOOL (WINAPI *CreateDirectoryV)(const void *path, LPSECURITY_ATTRIBUTES secattr); 66 | extern BOOL (WINAPI *RemoveDirectoryV)(const void *path); 67 | extern DWORD (WINAPI *GetCurrentDirectoryV)(DWORD size, void *path); 68 | extern BOOL (WINAPI *SetCurrentDirectoryV)(const void *path); 69 | extern BOOL (WINAPI *DeleteFileV)(const void *path); 70 | extern DWORD (WINAPI *GetModuleFileNameV)(HMODULE hMod, void *path, DWORD len); 71 | extern DWORD (WINAPI *GetFullPathNameV)(const void *path, DWORD len, void *buf, void **fname); 72 | extern BOOL (WINAPI *GetDiskFreeSpaceV)(const void *path, DWORD *spc, DWORD *bps, DWORD *fc, 73 | DWORD *cl); 74 | extern DWORD (WINAPI *GetDriveTypeV)(const void *path); 75 | extern BOOL (WINAPI *GetVolumeInformationV)(const void *, void *, DWORD, DWORD *, DWORD *, 76 | DWORD *, void *, DWORD); 77 | extern UINT (WINAPI *DragQueryFileV)(HDROP, UINT, void *, UINT); 78 | extern BOOL (WINAPI *GetOpenFileNameV)(LPOPENFILENAMEW); 79 | extern BOOL (WINAPI *GetSaveFileNameV)(LPOPENFILENAMEW); 80 | extern BOOL (WINAPI *InsertMenuV)(HMENU, UINT, UINT, UINT, const void *); 81 | extern BOOL (WINAPI *ModifyMenuV)(HMENU, UINT, UINT, UINT, const void *); 82 | 83 | #if _MSC_VER <= 1200 84 | #define MONITOR_DEFAULTTONULL 0x00000000 85 | #define MONITOR_DEFAULTTOPRIMARY 0x00000001 86 | #define MONITOR_DEFAULTTONEAREST 0x00000002 87 | 88 | typedef HANDLE HMONITOR; 89 | typedef struct { 90 | DWORD cbSize; 91 | RECT rcMonitor; 92 | RECT rcWork; 93 | DWORD dwFlags; 94 | } MONITORINFO; 95 | #endif 96 | 97 | extern BOOL (WINAPI *GetMonitorInfoV)(HMONITOR hMonitor, MONITORINFO *lpmi); 98 | extern HMONITOR (WINAPI *MonitorFromPointV)(POINT pt, DWORD dwFlags); 99 | 100 | 101 | extern BOOL (WINAPI *SHGetPathFromIDListV)(LPCITEMIDLIST, void *); 102 | extern LPITEMIDLIST (WINAPI *SHBrowseForFolderV)(BROWSEINFO *); 103 | extern LPITEMIDLIST (WINAPI *ILCreateFromPathV)(void *); 104 | extern void (WINAPI *ILFreeV)(LPITEMIDLIST); 105 | extern GUID IID_IShellLinkV; 106 | extern HINSTANCE (WINAPI *ShellExecuteV)(HWND hWnd, const void *, const void *, void *, 107 | const void *, int); 108 | extern BOOL (WINAPI *ShellExecuteExV)(LPSHELLEXECUTEINFO); 109 | extern HMODULE (WINAPI *LoadLibraryV)(void *); 110 | extern BOOL (WINAPI *PlaySoundV)(const void *, HMODULE, DWORD); 111 | 112 | extern void *(WINAPI *GetCommandLineV)(void); 113 | extern void *(WINAPI *CharUpperV)(void *str); 114 | extern void *(WINAPI *CharLowerV)(void *str); 115 | extern int (WINAPI *lstrcmpiV)(const void *str1, const void *str2); 116 | extern int (WINAPI *lstrlenV)(const void *str); 117 | extern void *(*lstrchrV)(const void *str, int); 118 | extern WCHAR (*lGetCharV)(const void *, int); 119 | extern void (*lSetCharV)(void *, int, WCHAR); 120 | extern WCHAR (*lGetCharIncV)(const void **); 121 | extern int (*strcmpV)(const void *str1, const void *str2); // static ... for qsort 122 | extern int (*strnicmpV)(const void *str1, const void *str2, int len); 123 | extern int (*strlenV)(const void *path); 124 | extern void *(*strcpyV)(void *dst, const void *src); 125 | extern void *(*strdupV)(const void *src); 126 | extern void *(*strchrV)(const void *src, int); 127 | extern void *(*strrchrV)(const void *src, int); 128 | extern long (*strtolV)(const void *, const void **, int base); 129 | extern u_long (*strtoulV)(const void *, const void **, int base); 130 | extern int (*sprintfV)(void *buf, const void *format,...); 131 | extern int (*MakePathV)(void *dest, const void *dir, const void *file); 132 | 133 | extern void *ASTERISK_V; // "*" 134 | extern void *FMT_CAT_ASTER_V; // "%s\\*" 135 | extern void *FMT_STR_V; // "%s" 136 | extern void *FMT_QUOTE_STR_V; // "\"%s\"" 137 | extern void *FMT_INT_STR_V; // "%d" 138 | extern void *BACK_SLASH_V; // "\\" 139 | extern void *SEMICOLON_V; // ";" 140 | extern void *SEMICLN_SPC_V; // "; " 141 | extern void *NEWLINE_STR_V; // "\r\n" 142 | extern void *EMPTY_STR_V; // "" 143 | extern void *DOT_V; // "." 144 | extern void *DOTDOT_V; // ".." 145 | extern void *QUOTE_V; // "\"" 146 | extern void *TRUE_V; // "true" 147 | extern void *FALSE_V; // "false" 148 | extern int CHAR_LEN_V; // 2(WCHAR) or 1(char) 149 | extern int MAX_PATHLEN_V; 150 | extern BOOL IS_WINNT_V; 151 | extern DWORD SHCNF_PATHV; 152 | 153 | inline void *MakeAddr(const void *addr, int len) { return (BYTE *)addr + len * CHAR_LEN_V; } 154 | inline void SetChar(void *addr, int offset, int val) { 155 | IS_WINNT_V ? (*(WCHAR *)MakeAddr(addr, offset) = val) 156 | : (*(char *)MakeAddr(addr, offset) = val); 157 | } 158 | inline WCHAR GetChar(const void *addr, int offset) { 159 | return IS_WINNT_V ? *(WCHAR *)MakeAddr(addr, offset) : *(char *)MakeAddr(addr, offset); 160 | } 161 | inline int DiffLen(const void *high, const void *low) { 162 | return (int)(IS_WINNT_V ? (WCHAR *)high - (WCHAR *)low : (char *)high - (char *)low); 163 | } 164 | 165 | void InitWin32API_V(void); 166 | void *GetLoadStrV(UINT resId, HINSTANCE hI=NULL); 167 | 168 | #ifdef UNICODE 169 | #define GetLoadStr GetLoadStrW 170 | #else 171 | #define GetLoadStr GetLoadStrA 172 | #endif 173 | 174 | #if _MSC_VER < 1200 175 | typedef struct _REPARSE_GUID_DATA_BUFFER { 176 | DWORD ReparseTag; 177 | WORD ReparseDataLength; 178 | WORD Reserved; 179 | GUID ReparseGuid; 180 | struct { 181 | BYTE DataBuffer[1]; 182 | } GenericReparseBuffer; 183 | } REPARSE_GUID_DATA_BUFFER, *PREPARSE_GUID_DATA_BUFFER; 184 | 185 | #define MAXIMUM_REPARSE_DATA_BUFFER_SIZE (16 * 1024) 186 | #define IsReparseTagMicrosoft(x) ((x) & 0x80000000) 187 | #define FILE_ATTRIBUTE_REPARSE_POINT 0x00000400 188 | 189 | #define IO_REPARSE_TAG_MOUNT_POINT (0xA0000003L) 190 | #define IO_REPARSE_TAG_HSM (0xC0000004L) 191 | #define IO_REPARSE_TAG_SIS (0x80000007L) 192 | #define IO_REPARSE_TAG_DFS (0x8000000AL) 193 | #define IO_REPARSE_TAG_SYMLINK (0xA000000CL) 194 | #define IO_REPARSE_TAG_DFSR (0x80000012L) 195 | #endif 196 | 197 | #if _MSC_VER <= 1200 198 | #define FSCTL_SET_REPARSE_POINT 0x000900A4 199 | #define FSCTL_GET_REPARSE_POINT 0x000900A8 200 | #define FSCTL_DELETE_REPARSE_POINT 0x000900AC 201 | #define FILE_FLAG_OPEN_REPARSE_POINT 0x00200000 202 | #endif 203 | 204 | #if _MSC_VER != 1200 205 | typedef struct _REPARSE_DATA_BUFFER { 206 | DWORD ReparseTag; 207 | WORD ReparseDataLength; 208 | WORD Reserved; 209 | union { 210 | struct { 211 | WORD SubstituteNameOffset; 212 | WORD SubstituteNameLength; 213 | WORD PrintNameOffset; 214 | WORD PrintNameLength; 215 | ULONG Flags; 216 | WCHAR PathBuffer[1]; 217 | } SymbolicLinkReparseBuffer; 218 | struct { 219 | WORD SubstituteNameOffset; 220 | WORD SubstituteNameLength; 221 | WORD PrintNameOffset; 222 | WORD PrintNameLength; 223 | WCHAR PathBuffer[1]; 224 | } MountPointReparseBuffer; 225 | struct { 226 | BYTE DataBuffer[1]; 227 | } GenericReparseBuffer; 228 | }; 229 | } REPARSE_DATA_BUFFER, *PREPARSE_DATA_BUFFER; 230 | #endif 231 | 232 | #define REPARSE_DATA_BUFFER_HEADER_SIZE FIELD_OFFSET(REPARSE_DATA_BUFFER, GenericReparseBuffer) 233 | #define REPARSE_GUID_DATA_BUFFER_HEADER_SIZE \ 234 | FIELD_OFFSET(REPARSE_GUID_DATA_BUFFER, GenericReparseBuffer) 235 | 236 | #define IsReparseTagJunction(r) \ 237 | (((REPARSE_DATA_BUFFER *)r)->ReparseTag == IO_REPARSE_TAG_MOUNT_POINT) 238 | #define IsReparseTagSymlink(r) \ 239 | (((REPARSE_DATA_BUFFER *)r)->ReparseTag == IO_REPARSE_TAG_SYMLINK) 240 | 241 | #ifndef SE_CREATE_SYMBOLIC_LINK_NAME 242 | #define SE_CREATE_SYMBOLIC_LINK_NAME "SeCreateSymbolicLinkPrivilege" 243 | #endif 244 | 245 | BOOL TLibInit_Win32V(); 246 | 247 | #endif 248 | -------------------------------------------------------------------------------- /src/tlib/tapp.cpp: -------------------------------------------------------------------------------- 1 | static char *tapp_id = 2 | "@(#)Copyright (C) 1996-2009 H.Shirouzu tapp.cpp Ver0.99"; 3 | /* ======================================================================== 4 | Project Name : Win32 Lightweight Class Library Test 5 | Module Name : Application Frame Class 6 | Create : 1996-06-01(Sat) 7 | Update : 2009-03-09(Mon) 8 | Copyright : H.Shirouzu 9 | Reference : 10 | ======================================================================== */ 11 | 12 | #include "tlib.h" 13 | 14 | TApp *TApp::tapp = NULL; 15 | #define MAX_TAPPWIN_HASH 1009 16 | #define ENGLISH_TEST 0 17 | 18 | TApp::TApp(HINSTANCE _hI, LPSTR _cmdLine, int _nCmdShow) 19 | { 20 | hI = _hI; 21 | cmdLine = _cmdLine; 22 | nCmdShow = _nCmdShow; 23 | mainWnd = NULL; 24 | defaultClass = "tapp"; 25 | defaultClassV = IS_WINNT_V ? (void *)L"tapp" : (void *)"tapp"; 26 | tapp = this; 27 | hash = new TWinHashTbl(MAX_TAPPWIN_HASH); 28 | 29 | InitInstanceForLoadStr(hI); 30 | TLibInit_Win32V(); 31 | 32 | #if ENGLISH_TEST 33 | TSetDefaultLCID(0x409); // for English Dialog Test 34 | #else 35 | TSetDefaultLCID(); 36 | #endif 37 | ::CoInitialize(NULL); 38 | ::InitCommonControls(); 39 | } 40 | 41 | TApp::~TApp() 42 | { 43 | delete mainWnd; 44 | ::CoUninitialize(); 45 | } 46 | 47 | int TApp::Run(void) 48 | { 49 | MSG msg; 50 | 51 | InitApp(); 52 | InitWindow(); 53 | 54 | while (::GetMessage(&msg, NULL, 0, 0)) 55 | { 56 | if (PreProcMsg(&msg)) 57 | continue; 58 | 59 | ::TranslateMessage(&msg); 60 | ::DispatchMessage(&msg); 61 | } 62 | 63 | return (int)msg.wParam; 64 | } 65 | 66 | BOOL TApp::PreProcMsg(MSG *msg) // for TranslateAccel & IsDialogMessage 67 | { 68 | for (HWND hWnd=msg->hwnd; hWnd != NULL; hWnd=::GetParent(hWnd)) 69 | { 70 | TWin *win = SearchWnd(hWnd); 71 | 72 | if (win != NULL) 73 | return win->PreProcMsg(msg); 74 | } 75 | 76 | return FALSE; 77 | } 78 | 79 | LRESULT CALLBACK TApp::WinProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) 80 | { 81 | TApp *app = TApp::GetApp(); 82 | TWin *win = app->SearchWnd(hWnd); 83 | 84 | if (win) 85 | return win->WinProc(uMsg, wParam, lParam); 86 | 87 | if ((win = app->preWnd) != NULL) 88 | { 89 | app->preWnd = NULL; 90 | app->AddWinByWnd(win, hWnd); 91 | return win->WinProc(uMsg, wParam, lParam); 92 | } 93 | 94 | return ::DefWindowProc(hWnd, uMsg, wParam, lParam); 95 | } 96 | 97 | BOOL TApp::InitApp(void) // reference kwc 98 | { 99 | WNDCLASSW wc; 100 | 101 | memset(&wc, 0, sizeof(wc)); 102 | wc.style = (CS_BYTEALIGNCLIENT | CS_BYTEALIGNWINDOW | CS_DBLCLKS); 103 | wc.lpfnWndProc = WinProc; 104 | wc.cbClsExtra = 0; 105 | wc.cbWndExtra = 0; 106 | wc.hInstance = hI; 107 | wc.hIcon = NULL; 108 | wc.hCursor = LoadCursor(NULL, IDC_ARROW); 109 | wc.hbrBackground = NULL; 110 | wc.lpszMenuName = NULL; 111 | wc.lpszClassName = (LPCWSTR)defaultClassV; 112 | 113 | if (::FindWindowV(defaultClassV, NULL) == NULL) 114 | { 115 | if (::RegisterClassV(&wc) == 0) 116 | return FALSE; 117 | } 118 | 119 | return TRUE; 120 | } 121 | 122 | BOOL TRegisterClass(LPCSTR class_name, UINT style, HICON hIcon, HCURSOR hCursor, 123 | HBRUSH hbrBackground, int classExtra, int wndExtra, LPCSTR menu_str) 124 | { 125 | WNDCLASS wc; 126 | 127 | memset(&wc, 0, sizeof(wc)); 128 | wc.style = style; 129 | wc.lpfnWndProc = TApp::WinProc; 130 | wc.cbClsExtra = classExtra; 131 | wc.cbWndExtra = wndExtra; 132 | wc.hInstance = TApp::GetInstance(); 133 | wc.hIcon = hIcon; 134 | wc.hCursor = hCursor; 135 | wc.hbrBackground = hbrBackground; 136 | wc.lpszMenuName = menu_str; 137 | wc.lpszClassName = class_name; 138 | 139 | return ::RegisterClass(&wc); 140 | } 141 | 142 | BOOL TRegisterClassV(const void *class_name, UINT style, HICON hIcon, HCURSOR hCursor, 143 | HBRUSH hbrBackground, int classExtra, int wndExtra, const void *menu_str) 144 | { 145 | WNDCLASSW wc; 146 | 147 | memset(&wc, 0, sizeof(wc)); 148 | wc.style = style; 149 | wc.lpfnWndProc = TApp::WinProc; 150 | wc.cbClsExtra = classExtra; 151 | wc.cbWndExtra = wndExtra; 152 | wc.hInstance = TApp::GetInstance(); 153 | wc.hIcon = hIcon; 154 | wc.hCursor = hCursor; 155 | wc.hbrBackground = hbrBackground; 156 | wc.lpszMenuName = (LPCWSTR)menu_str; 157 | wc.lpszClassName = (LPCWSTR)class_name; 158 | 159 | return ::RegisterClassV(&wc); 160 | } 161 | 162 | BOOL TRegisterClassU8(LPCSTR class_name, UINT style, HICON hIcon, HCURSOR hCursor, 163 | HBRUSH hbrBackground, int classExtra, int wndExtra, LPCSTR menu_str) 164 | { 165 | Wstr class_name_w(class_name, BY_UTF8); 166 | Wstr menu_str_w(menu_str, BY_UTF8); 167 | 168 | return TRegisterClassV(class_name_w, style, hIcon, hCursor, hbrBackground, classExtra, 169 | wndExtra, menu_str_w); 170 | } 171 | 172 | -------------------------------------------------------------------------------- /src/tlib/tdlg.cpp: -------------------------------------------------------------------------------- 1 | static char *tdlg_id = 2 | "@(#)Copyright (C) 1996-2009 H.Shirouzu tdlg.cpp Ver0.97"; 3 | /* ======================================================================== 4 | Project Name : Win32 Lightweight Class Library Test 5 | Module Name : Dialog Class 6 | Create : 1996-06-01(Sat) 7 | Update : 2009-03-09(Mon) 8 | Copyright : H.Shirouzu 9 | Reference : 10 | ======================================================================== */ 11 | 12 | #include "tlib.h" 13 | #include 14 | 15 | TDlg::TDlg(UINT _resId, TWin *_parent) : TWin(_parent) 16 | { 17 | resId = _resId; 18 | modalFlg = FALSE; 19 | maxItems = 0; 20 | dlgItems = NULL; 21 | taskbarButtonCreatedMessage = RegisterWindowMessage(_T("TaskbarButtonCreated")); 22 | } 23 | 24 | TDlg::~TDlg() 25 | { 26 | if (hWnd) EndDialog(FALSE); 27 | delete [] dlgItems; 28 | } 29 | 30 | BOOL TDlg::Create(HINSTANCE hInstance) 31 | { 32 | TApp::GetApp()->AddWin(this); 33 | 34 | hWnd = ::CreateDialogV(hInstance ? hInstance : TApp::GetInstance(), (void *)resId, 35 | parent ? parent->hWnd : NULL, (DLGPROC)TApp::WinProc); 36 | 37 | if (hWnd) { 38 | // We have to tell Windows to allow the TaskbarButtonCreated message 39 | // to be sent to our window if our app is running elevated. 40 | // See http://www.codeproject.com/Articles/42345/Windows-7-Goodies-in-C-Taskbar-Progress-and-Status 41 | #if (WINVER >= 0x0600 && WINVER < 0x0601) 42 | ChangeWindowMessageFilter(taskbarButtonCreatedMessage, MSGFLT_ADD); 43 | #endif 44 | #if (WINVER >= 0x0601) 45 | CHANGEFILTERSTRUCT cfs = { sizeof(CHANGEFILTERSTRUCT) }; 46 | ChangeWindowMessageFilterEx(hWnd, taskbarButtonCreatedMessage, MSGFLT_ALLOW, &cfs ); 47 | #endif 48 | return TRUE; 49 | } else { 50 | return TApp::GetApp()->DelWin(this), FALSE; 51 | } 52 | } 53 | 54 | int TDlg::Exec(void) 55 | { 56 | TApp::GetApp()->AddWin(this); 57 | modalFlg = TRUE; 58 | int result = ::DialogBoxV(TApp::GetInstance(), (void *)resId, parent ? parent->hWnd : NULL, 59 | (DLGPROC)TApp::WinProc); 60 | modalFlg = FALSE; 61 | return result; 62 | } 63 | 64 | void TDlg::Destroy(void) 65 | { 66 | EndDialog(FALSE); 67 | } 68 | 69 | LRESULT TDlg::WinProc(UINT uMsg, WPARAM wParam, LPARAM lParam) 70 | { 71 | LRESULT result = 0; 72 | 73 | if (uMsg == taskbarButtonCreatedMessage) { 74 | EvTaskbarButtonCreated(); 75 | return 0; 76 | } 77 | 78 | switch (uMsg) 79 | { 80 | 81 | case WM_INITDIALOG: 82 | if (rect.left != CW_USEDEFAULT && !(::GetWindowLong(hWnd, GWL_STYLE) & WS_CHILD)) { 83 | MoveWindow(rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top,FALSE); 84 | } 85 | GetWindowRect(&orgRect); 86 | return EvCreate(lParam); 87 | 88 | case WM_CLOSE: 89 | EvClose(); 90 | return 0; 91 | 92 | case WM_COMMAND: 93 | EvCommand(HIWORD(wParam), LOWORD(wParam), lParam); 94 | return 0; 95 | 96 | case WM_SYSCOMMAND: 97 | EvSysCommand(wParam, MAKEPOINTS(lParam)); 98 | return 0; 99 | 100 | case WM_TIMER: 101 | EvTimer(wParam, (TIMERPROC)lParam); 102 | return 0; 103 | 104 | case WM_NCDESTROY: 105 | GetWindowRect(&rect); 106 | EvNcDestroy(); 107 | TApp::GetApp()->DelWin(this); 108 | hWnd = 0; 109 | return 0; 110 | 111 | case WM_QUERYENDSESSION: 112 | result = EvQueryEndSession((BOOL)wParam, (BOOL)lParam); 113 | SetWindowLong(DWL_MSGRESULT, result); 114 | return 0; 115 | 116 | case WM_ENDSESSION: 117 | EvEndSession((BOOL)wParam, (BOOL)lParam); 118 | return 0; 119 | 120 | case WM_QUERYOPEN: 121 | result = EvQueryOpen(); 122 | SetWindowLong(DWL_MSGRESULT, result); 123 | return result; 124 | 125 | case WM_PAINT: 126 | EvPaint(); 127 | return 0; 128 | 129 | case WM_NCPAINT: 130 | EvNcPaint((HRGN)wParam); 131 | return 0; 132 | 133 | case WM_SIZE: 134 | EvSize((UINT)wParam, LOWORD(lParam), HIWORD(lParam)); 135 | return 0; 136 | 137 | case WM_SHOWWINDOW: 138 | EvShowWindow((BOOL)wParam, (int)lParam); 139 | return 0; 140 | 141 | case WM_GETMINMAXINFO: 142 | EvGetMinMaxInfo((MINMAXINFO *)lParam); 143 | return 0; 144 | 145 | case WM_SETCURSOR: 146 | result = EvSetCursor((HWND)wParam, LOWORD(lParam), HIWORD(lParam)); 147 | SetWindowLong(DWL_MSGRESULT, result); 148 | return result; 149 | 150 | case WM_MOUSEMOVE: 151 | return EvMouseMove((UINT)wParam, MAKEPOINTS(lParam)); 152 | 153 | case WM_NCHITTEST: 154 | EvNcHitTest(MAKEPOINTS(lParam), &result); 155 | SetWindowLong(DWL_MSGRESULT, result); 156 | return result; 157 | 158 | case WM_MEASUREITEM: 159 | result = EvMeasureItem((UINT)wParam, (LPMEASUREITEMSTRUCT)lParam); 160 | SetWindowLong(DWL_MSGRESULT, result); 161 | return result; 162 | 163 | case WM_DRAWITEM: 164 | result = EvDrawItem((UINT)wParam, (LPDRAWITEMSTRUCT)lParam); 165 | SetWindowLong(DWL_MSGRESULT, result); 166 | return result; 167 | 168 | case WM_NOTIFY: 169 | result = EvNotify((UINT)wParam, (LPNMHDR)lParam); 170 | SetWindowLong(DWL_MSGRESULT, result); 171 | return result; 172 | 173 | case WM_CONTEXTMENU: 174 | result = EvContextMenu((HWND)wParam, MAKEPOINTS(lParam)); 175 | SetWindowLong(DWL_MSGRESULT, result); 176 | return result; 177 | 178 | case WM_HOTKEY: 179 | result = EvHotKey((int)wParam); 180 | SetWindowLong(DWL_MSGRESULT, result); 181 | return result; 182 | 183 | case WM_ACTIVATEAPP: 184 | EventActivateApp((BOOL)wParam, (DWORD)lParam); 185 | break; 186 | 187 | case WM_ACTIVATE: 188 | EventActivate(LOWORD(wParam), HIWORD(wParam), (HWND)lParam); 189 | break; 190 | 191 | case WM_LBUTTONUP: 192 | case WM_RBUTTONUP: 193 | case WM_NCLBUTTONUP: 194 | case WM_NCRBUTTONUP: 195 | case WM_LBUTTONDOWN: 196 | case WM_RBUTTONDOWN: 197 | case WM_NCLBUTTONDOWN: 198 | case WM_NCRBUTTONDOWN: 199 | case WM_LBUTTONDBLCLK: 200 | case WM_RBUTTONDBLCLK: 201 | case WM_NCLBUTTONDBLCLK: 202 | case WM_NCRBUTTONDBLCLK: 203 | EventButton(uMsg, (int)wParam, MAKEPOINTS(lParam)); 204 | return 0; 205 | 206 | case WM_KEYUP: 207 | case WM_KEYDOWN: 208 | EventKey(uMsg, (int)wParam, (LONG)lParam); 209 | return 0; 210 | 211 | case WM_HSCROLL: 212 | case WM_VSCROLL: 213 | EventScroll(uMsg, LOWORD(wParam), HIWORD(wParam), (HWND)lParam); 214 | return 0; 215 | 216 | case WM_INITMENU: 217 | case WM_INITMENUPOPUP: 218 | EventInitMenu(uMsg, (HMENU)wParam, LOWORD(lParam), (BOOL)HIWORD(lParam)); 219 | return 0; 220 | 221 | case WM_MENUSELECT: 222 | EvMenuSelect(LOWORD(wParam), (BOOL)HIWORD(wParam), (HMENU)lParam); 223 | return 0; 224 | 225 | case WM_DROPFILES: 226 | EvDropFiles((HDROP)wParam); 227 | return 0; 228 | 229 | case WM_CTLCOLORBTN: 230 | case WM_CTLCOLORDLG: 231 | case WM_CTLCOLOREDIT: 232 | case WM_CTLCOLORLISTBOX: 233 | case WM_CTLCOLORMSGBOX: 234 | case WM_CTLCOLORSCROLLBAR: 235 | case WM_CTLCOLORSTATIC: 236 | EventCtlColor(uMsg, (HDC)wParam, (HWND)lParam, (HBRUSH *)&result); 237 | SetWindowLong(DWL_MSGRESULT, result); 238 | return result; 239 | 240 | case WM_KILLFOCUS: 241 | case WM_SETFOCUS: 242 | EventFocus(uMsg, (HWND)wParam); 243 | return 0; 244 | 245 | default: 246 | if (uMsg >= WM_USER && uMsg <= 0x7FFF || uMsg >= 0xC000 && uMsg <= 0xFFFF) 247 | result = EventUser(uMsg, wParam, lParam); 248 | else 249 | result = EventSystem(uMsg, wParam, lParam); 250 | SetWindowLong(DWL_MSGRESULT, result); 251 | return result; 252 | } 253 | 254 | return FALSE; 255 | } 256 | 257 | BOOL TDlg::PreProcMsg(MSG *msg) 258 | { 259 | if (hAccel && ::TranslateAccelerator(hWnd, hAccel, msg)) 260 | return TRUE; 261 | 262 | if (!modalFlg) 263 | return ::IsDialogMessage(hWnd, msg); 264 | 265 | return FALSE; 266 | } 267 | 268 | BOOL TDlg::EvSysCommand(WPARAM uCmdType, POINTS pos) 269 | { 270 | return FALSE; 271 | } 272 | 273 | BOOL TDlg::EvCommand(WORD wNotifyCode, WORD wID, LPARAM hwndCtl) 274 | { 275 | switch (wID) 276 | { 277 | case IDOK: case IDCANCEL: case IDYES: case IDNO: 278 | case IDABORT: case IDIGNORE: case IDRETRY: 279 | EndDialog(wID); 280 | return TRUE; 281 | } 282 | 283 | return FALSE; 284 | } 285 | 286 | BOOL TDlg::EvTaskbarButtonCreated() 287 | { 288 | return TRUE; 289 | } 290 | 291 | BOOL TDlg::EvQueryOpen(void) 292 | { 293 | return FALSE; 294 | } 295 | 296 | BOOL TDlg::EvCreate(LPARAM lParam) 297 | { 298 | return TRUE; 299 | } 300 | 301 | void TDlg::EndDialog(int result) 302 | { 303 | if (::IsWindow(hWnd)) 304 | { 305 | if (modalFlg) 306 | ::EndDialog(hWnd, result); 307 | else 308 | ::DestroyWindow(hWnd); 309 | } 310 | } 311 | 312 | int TDlg::SetDlgItem(UINT ctl_id, DWORD flags) 313 | { 314 | WINDOWPLACEMENT wp; 315 | wp.length = sizeof(wp); 316 | 317 | #define BIG_ALLOC 16 318 | if ((maxItems % BIG_ALLOC) == 0) { 319 | DlgItem *p = (DlgItem *)realloc(dlgItems, (maxItems + BIG_ALLOC) * sizeof(DlgItem)); 320 | if (!p) return -1; 321 | dlgItems = p; 322 | } 323 | DlgItem *item = dlgItems + maxItems; 324 | 325 | item->hWnd = GetDlgItem(ctl_id); 326 | ::GetWindowPlacement(item->hWnd, &wp); 327 | item->wpos.x = wp.rcNormalPosition.left; 328 | item->wpos.y = wp.rcNormalPosition.top; 329 | item->wpos.cx = wp.rcNormalPosition.right - wp.rcNormalPosition.left; 330 | item->wpos.cy = wp.rcNormalPosition.bottom - wp.rcNormalPosition.top; 331 | item->flags = flags; 332 | 333 | return maxItems++; 334 | } 335 | 336 | BOOL TDlg::FitDlgItems() 337 | { 338 | GetWindowRect(&rect); 339 | int xdiff = (rect.right - rect.left) - (orgRect.right - orgRect.left); 340 | int ydiff = (rect.bottom - rect.top) - (orgRect.bottom - orgRect.top); 341 | 342 | HDWP hdwp = ::BeginDeferWindowPos(maxItems); // MAX item number 343 | UINT dwFlg = SWP_SHOWWINDOW | SWP_NOZORDER; 344 | 345 | for (int i=0; i < maxItems; i++) { 346 | DlgItem *item = dlgItems + i; 347 | DWORD f = item->flags; 348 | 349 | if (f & FIT_SKIP) continue; 350 | int x = (f & LEFT_FIT) == LEFT_FIT ? item->wpos.x : item->wpos.x + xdiff; 351 | int y = (f & TOP_FIT) == TOP_FIT ? item->wpos.y : item->wpos.y + ydiff; 352 | int w = (f & X_FIT) == X_FIT ? item->wpos.cx + xdiff : item->wpos.cx; 353 | int h = (f & Y_FIT) == Y_FIT ? item->wpos.cy + ydiff : item->wpos.cy; 354 | 355 | hdwp = ::DeferWindowPos(hdwp, item->hWnd, 0, x, y, w, h, dwFlg); 356 | } 357 | EndDeferWindowPos(hdwp); 358 | 359 | return TRUE; 360 | } 361 | -------------------------------------------------------------------------------- /src/tlib/tini.cpp: -------------------------------------------------------------------------------- 1 | static char *tini_id = 2 | "@(#)Copyright (C) 1996-2010 H.Shirouzu tini.cpp Ver0.97"; 3 | /* ======================================================================== 4 | Project Name : Win32 Lightweight Class Library Test 5 | Module Name : Registry Class 6 | Create : 1996-06-01(Sat) 7 | Update : 2010-05-09(Sun) 8 | Copyright : H.Shirouzu 9 | Reference : 10 | ======================================================================== */ 11 | 12 | #include 13 | #include 14 | #include 15 | #include "tlib.h" 16 | 17 | TInifile::TInifile(const char *_ini_file) 18 | { 19 | ini_file = NULL; 20 | if (_ini_file) Init(_ini_file); 21 | root_sec = cur_sec = NULL; 22 | ini_size = -1; 23 | hMutex = NULL; 24 | } 25 | 26 | TInifile::~TInifile(void) 27 | { 28 | free(ini_file); 29 | if (hMutex) ::CloseHandle(hMutex); 30 | } 31 | 32 | BOOL TInifile::Strip(const char *s, char *d, const char *strip_chars, const char *quote_chars) 33 | { 34 | const char *sv_s = s; 35 | const char *e = s + strlen(s); 36 | int len; 37 | char start_quote = quote_chars[0]; 38 | char end_quote = quote_chars[1]; 39 | 40 | if (!d) d = (char *)s; 41 | 42 | while (*s && strchr(strip_chars, *s)) s++; 43 | 44 | if (*s == start_quote) { 45 | s++; 46 | while (s <= e && *e != end_quote) e--; 47 | if (s > e) goto ERR; 48 | } 49 | else { 50 | e--; 51 | while (s <= e && strchr(strip_chars, *e)) e--; 52 | if (s > e) goto ERR; 53 | e++; 54 | } 55 | 56 | len = (int)(e - s); 57 | memmove(d, s, len); 58 | d[len] = 0; 59 | return TRUE; 60 | 61 | ERR: 62 | if (sv_s != d) strcpy(d, sv_s); 63 | return FALSE; 64 | } 65 | 66 | BOOL TInifile::Parse(const char *buf, BOOL *is_section, char *name, char *val) 67 | { 68 | const char *p = buf; 69 | 70 | while (*p && strchr(" \t\r\n", *p)) p++; 71 | 72 | if (*p == '[') { 73 | if (!Strip(p, name, " \t\r\n", "[]")) return FALSE; 74 | *is_section = TRUE; 75 | return TRUE; 76 | } 77 | 78 | *is_section = FALSE; 79 | 80 | if (!isalnum(*p)) return FALSE; 81 | 82 | const char *e = p; 83 | while (*e && *e != '=') e++; 84 | if (*e != '=') return FALSE; 85 | 86 | int len = (int)(e - p); 87 | memcpy(name, p, len); 88 | name[len] = 0; 89 | 90 | if (!Strip(name)) return FALSE; 91 | 92 | strcpy(val, e+1); 93 | return Strip(val); 94 | } 95 | 96 | BOOL TInifile::GetFileInfo(const char *fname, FILETIME *ft, int *size) 97 | { 98 | WIN32_FIND_DATA fdat; 99 | HANDLE hFind = FindFirstFile(fname, &fdat); 100 | 101 | if (hFind == INVALID_HANDLE_VALUE) return FALSE; 102 | 103 | *ft = fdat.ftLastWriteTime; 104 | *size = fdat.nFileSizeLow; 105 | 106 | FindClose(hFind); 107 | return TRUE; 108 | } 109 | 110 | BOOL TInifile::Lock() 111 | { 112 | if (!hMutex) { 113 | char buf[1024]; 114 | char *key = (char *)_mbsrchr((u_char *)ini_file, '\\'); 115 | 116 | key = key ? key+1 : ini_file; 117 | 118 | sprintf(buf, "%s_%x", key, MakeHash(ini_file, (int)strlen(ini_file), 0)); 119 | 120 | if (!(hMutex = ::CreateMutex(NULL, FALSE, buf))) return FALSE; 121 | } 122 | 123 | return ::WaitForSingleObject(hMutex, INFINITE); 124 | } 125 | 126 | void TInifile::UnLock() 127 | { 128 | if (hMutex) ReleaseMutex(hMutex); 129 | } 130 | 131 | void TInifile::Init(const char *_ini_file) 132 | { 133 | if (_ini_file) ini_file = strdup(_ini_file); 134 | 135 | Lock(); 136 | FILE *fp = fopen(ini_file, "r"); 137 | 138 | AddObj(root_sec = new TIniSection()); 139 | 140 | if (fp) { 141 | #define MAX_INI_LINE (64 * 1024) 142 | char *buf = new char [MAX_INI_LINE]; 143 | char *val = new char [MAX_INI_LINE]; 144 | char name[1024]; 145 | BOOL is_section; 146 | 147 | TIniSection *target_sec=root_sec; 148 | 149 | while (fgets(buf, MAX_INI_LINE, fp)) { 150 | BOOL ret = Parse(buf, &is_section, name, val); 151 | 152 | if (!ret) { 153 | target_sec->AddKey(NULL, buf); 154 | } 155 | else if (is_section) { 156 | target_sec = new TIniSection(); 157 | target_sec->Set(name); 158 | AddObj(target_sec); 159 | } 160 | else { 161 | target_sec->AddKey(name, val); 162 | } 163 | } 164 | delete [] val; 165 | delete [] buf; 166 | fclose(fp); 167 | // GetFileInfo(ini_file, &ini_ft, &ini_size); 168 | } 169 | UnLock(); 170 | } 171 | 172 | void TInifile::UnInit() 173 | { 174 | for (TIniSection *sec; (sec = (TIniSection *)TopObj()); ) { 175 | DelObj(sec); 176 | delete sec; 177 | } 178 | root_sec = NULL; 179 | } 180 | 181 | BOOL TInifile::WriteIni() 182 | { 183 | Lock(); 184 | 185 | BOOL ret = FALSE; 186 | FILE *fp = fopen(ini_file, "w"); 187 | 188 | if (fp) { 189 | for (TIniSection *sec = (TIniSection *)TopObj(); sec; sec = (TIniSection *)NextObj(sec)) { 190 | TIniKey *key = (TIniKey *)sec->TopObj(); 191 | if (key) { 192 | if (sec->Name()) { 193 | if (fprintf(fp, "[%s]\n", sec->Name()) < 0) goto END; 194 | } 195 | while (key) { 196 | if (key->Key()) { 197 | if (fprintf(fp, "%s=\"%s\"\n", key->Key(), key->Val()) < 0) goto END; 198 | } 199 | else { 200 | if (fprintf(fp, "%s", key->Val()) < 0) goto END; 201 | } 202 | key = (TIniKey *)sec->NextObj(key); 203 | } 204 | } 205 | } 206 | ret = TRUE; 207 | END: 208 | fclose(fp); 209 | } 210 | UnLock(); 211 | 212 | return ret; 213 | } 214 | 215 | BOOL TInifile::StartUpdate() 216 | { 217 | /* FILETIME ft; 218 | int size; 219 | 220 | if (GetFileInfo(ini_file, &ft, &size) && (CompareFileTime(&ft, &ini_ft) || size != ini_size)){ 221 | UnInit(); 222 | Init(); 223 | } 224 | */ return TRUE; 225 | } 226 | 227 | BOOL TInifile::EndUpdate() 228 | { 229 | return WriteIni(); 230 | } 231 | 232 | TIniSection *TInifile::SearchSection(const char *section) 233 | { 234 | for (TIniSection *sec = root_sec; sec; sec = (TIniSection *)NextObj(sec)) { 235 | if (sec->Name() && strcmpi(sec->Name(), section) == 0) return sec; 236 | } 237 | return NULL; 238 | } 239 | 240 | void TInifile::SetSection(const char *section) 241 | { 242 | if (cur_sec && cur_sec != root_sec && !cur_sec->TopObj()) { 243 | DelObj(cur_sec); 244 | delete cur_sec; 245 | } 246 | 247 | if ((cur_sec = SearchSection(section)) == NULL) { 248 | cur_sec = new TIniSection(); 249 | cur_sec->Set(section); 250 | AddObj(cur_sec); 251 | } 252 | } 253 | 254 | BOOL TInifile::DelSection(const char *section) 255 | { 256 | TIniSection *sec = SearchSection(section); 257 | 258 | if (!sec) return FALSE; 259 | 260 | DelObj(sec); 261 | delete sec; 262 | if (sec == cur_sec) cur_sec = NULL; 263 | return TRUE; 264 | } 265 | 266 | BOOL TInifile::DelKey(const char *key) 267 | { 268 | return cur_sec ? cur_sec->DelKey(key) : FALSE; 269 | } 270 | 271 | BOOL TInifile::SetStr(const char *key, const char *val) 272 | { 273 | if (!val) return DelKey(key); 274 | return cur_sec ? cur_sec->AddKey(key, val) : FALSE; 275 | } 276 | 277 | DWORD TInifile::GetStr(const char *key_name, char *val, int max_size, const char *default_val) 278 | { 279 | TIniKey *key = cur_sec ? cur_sec->SearchKey(key_name) : NULL; 280 | return sprintf(val, "%.*s", max_size, key ? key->Val() : default_val); 281 | } 282 | 283 | BOOL TInifile::SetInt(const char *key, int val) 284 | { 285 | char buf[100]; 286 | sprintf(buf, "%d", val); 287 | return SetStr(key, buf); 288 | } 289 | 290 | int TInifile::GetInt(const char *key, int default_val) 291 | { 292 | char buf[100]; 293 | if (GetStr(key, buf, sizeof(buf), "") <= 0) return default_val; 294 | return atoi(buf); 295 | } 296 | 297 | -------------------------------------------------------------------------------- /src/tlib/tlib.h: -------------------------------------------------------------------------------- 1 | /* @(#)Copyright (C) 1996-2010 H.Shirouzu tlib.h Ver0.99 */ 2 | /* ======================================================================== 3 | Project Name : Win32 Lightweight Class Library Test 4 | Module Name : Main Header 5 | Create : 1996-06-01(Sat) 6 | Update : 2010-05-09(Mon) 7 | Copyright : H.Shirouzu 8 | Reference : 9 | ======================================================================== */ 10 | 11 | #ifndef TLIB_H 12 | #define TLIB_H 13 | 14 | #ifndef STRICT 15 | #define STRICT 16 | #endif 17 | 18 | // for debug allocator (like a efence) 19 | //#define REPLACE_DEBUG_ALLOCATOR 20 | #ifdef REPLACE_DEBUG_ALLOCATOR 21 | #define malloc valloc 22 | #define calloc vcalloc 23 | #define realloc vrealloc 24 | #define free vfree 25 | #define strdup vstrdup 26 | #define wcsdup vwcsdup 27 | extern "C" { 28 | void *valloc(size_t size); 29 | void *vcalloc(size_t num, size_t ele); 30 | void *vrealloc(void *d, size_t size); 31 | void vfree(void *d); 32 | char *vstrdup(const char *s); 33 | //unsigned short *vwcsdup(const unsigned short *s); 34 | } 35 | #endif 36 | 37 | /* for crypto api */ 38 | #define _WIN32_WINNT 0x0600 39 | 40 | /* for new version VC */ 41 | #if _MSC_VER >= 1400 42 | #pragma warning ( disable : 4996 ) 43 | #else 44 | #define LONG_PTR LONG 45 | #endif 46 | #pragma warning ( disable : 4355 ) 47 | 48 | #include 49 | #include 50 | #include 51 | #include 52 | 53 | #include "commctrl.h" 54 | #include 55 | #include 56 | #include 57 | #include "tapi32ex.h" 58 | #include "tapi32v.h" 59 | //#include "tapi32u8.h" /* describe last line */ 60 | 61 | extern DWORD TWinVersion; // define in tmisc.cpp 62 | 63 | #define WINEXEC_ERR_MAX 31 64 | #define TLIB_SLEEPTIMER 32000 65 | 66 | #define TLIB_CRYPT 0x00000001 67 | #define TLIB_PROTECT 0x00000002 68 | #define TLIB_WIN32V 0x00000004 69 | 70 | #define IsNewShell() (LOBYTE(LOWORD(TWinVersion)) >= 4) 71 | 72 | #define IsWin31() (LOBYTE(LOWORD(TWinVersion)) == 3 && HIBYTE(LOWORD(TWinVersion)) < 20) 73 | #define IsWin95() (LOBYTE(LOWORD(TWinVersion)) >= 4 && TWinVersion >= 0x80000000) 74 | 75 | #define IsWinNT350() (LOBYTE(LOWORD(TWinVersion)) == 3 && TWinVersion < 0x80000000 \ 76 | && HIBYTE(LOWORD(TWinVersion)) == 50) 77 | #define IsWinNT() (LOBYTE(LOWORD(TWinVersion)) >= 4 && TWinVersion < 0x80000000) 78 | #define IsWin2K() (LOBYTE(LOWORD(TWinVersion)) >= 5 && TWinVersion < 0x80000000) 79 | #define IsWinXP() ((LOBYTE(LOWORD(TWinVersion)) >= 6 || LOBYTE(LOWORD(TWinVersion)) == 5 \ 80 | && HIBYTE(LOWORD(TWinVersion)) >= 10) && TWinVersion < 0x80000000) 81 | #define IsWinVista() (LOBYTE(LOWORD(TWinVersion)) >= 6 && TWinVersion < 0x80000000) 82 | 83 | #define IsLang(lang) (PRIMARYLANGID(LANGIDFROMLCID(GetThreadLocale())) == lang) 84 | 85 | #define ALIGN_SIZE(all_size, block_size) (((all_size) + (block_size) -1) \ 86 | / (block_size) * (block_size)) 87 | 88 | #define ALIGN_BLOCK(size, align_size) (((size) + (align_size) -1) / (align_size)) 89 | 90 | #define BUTTON_CLASS "BUTTON" 91 | #define COMBOBOX_CLASS "COMBOBOX" 92 | #define EDIT_CLASS "EDIT" 93 | #define LISTBOX_CLASS "LISTBOX" 94 | #define MDICLIENT_CLASS "MDICLIENT" 95 | #define SCROLLBAR_CLASS "SCROLLBAR" 96 | #define STATIC_CLASS "STATIC" 97 | 98 | #define MAX_WPATH 32000 99 | #define MAX_PATH_EX (MAX_PATH * 8) 100 | #define MAX_PATH_U8 (MAX_PATH * 3) 101 | #define MAX_FNAME_LEN 255 102 | 103 | #define BITS_OF_BYTE 8 104 | #define BYTE_NUM 256 105 | 106 | #ifndef EM_SETTARGETDEVICE 107 | #define COLOR_BTNFACE 15 108 | #define COLOR_3DFACE COLOR_BTNFACE 109 | #define EM_SETBKGNDCOLOR (WM_USER + 67) 110 | #define EM_SETTARGETDEVICE (WM_USER + 72) 111 | #endif 112 | 113 | #ifndef WM_COPYGLOBALDATA 114 | #define WM_COPYGLOBALDATA 0x0049 115 | #endif 116 | 117 | #ifndef CSIDL_PROGRAM_FILES 118 | #define CSIDL_LOCAL_APPDATA 0x001c 119 | #define CSIDL_WINDOWS 0x0024 120 | #define CSIDL_PROGRAM_FILES 0x0026 121 | #endif 122 | #ifndef CSIDL_PROGRAM_FILESX86 123 | #define CSIDL_PROGRAM_FILESX86 0x002a 124 | #endif 125 | 126 | #ifndef CSIDL_APPDATA 127 | #define CSIDL_APPDATA 0x1a 128 | #endif 129 | 130 | #ifndef CSIDL_COMMON_APPDATA 131 | #define CSIDL_COMMON_APPDATA 0x23 132 | #endif 133 | 134 | #ifndef SHCNF_PATHW 135 | #define SHCNF_PATHW 0x0005 136 | #endif 137 | 138 | #ifndef BCM_FIRST 139 | #define BCM_FIRST 0x1600 140 | #define IDI_SHIELD 1022 141 | #endif 142 | 143 | #ifndef BCM_SETSHIELD 144 | #define BCM_SETSHIELD (BCM_FIRST + 0x000C) 145 | #endif 146 | 147 | #ifndef PROCESS_MODE_BACKGROUND_BEGIN 148 | #define PROCESS_MODE_BACKGROUND_BEGIN 0x00100000 149 | #define PROCESS_MODE_BACKGROUND_END 0x00200000 150 | #endif 151 | 152 | 153 | #ifdef _WIN64 154 | #define SetClassLongA SetClassLongPtrA 155 | #define SetClassLongW SetClassLongPtrW 156 | #define GetClassLongA GetClassLongPtrA 157 | #define GetClassLongW GetClassLongPtrW 158 | #define SetWindowLongA SetWindowLongPtrA 159 | #define SetWindowLongW SetWindowLongPtrW 160 | #define GetWindowLongA GetWindowLongPtrA 161 | #define GetWindowLongW GetWindowLongPtrW 162 | #define GCL_HICON GCLP_HICON 163 | #define GWL_WNDPROC GWLP_WNDPROC 164 | #define DWL_MSGRESULT DWLP_MSGRESULT 165 | #else 166 | #define DWORD_PTR DWORD 167 | #endif 168 | 169 | struct WINPOS { 170 | int x; 171 | int y; 172 | int cx; 173 | int cy; 174 | }; 175 | 176 | enum DlgItemFlags { 177 | NONE_FIT = 0x000, 178 | LEFT_FIT = 0x001, 179 | RIGHT_FIT = 0x002, 180 | TOP_FIT = 0x004, 181 | BOTTOM_FIT = 0x008, 182 | FIT_SKIP = 0x800, 183 | X_FIT = LEFT_FIT|RIGHT_FIT, 184 | Y_FIT = TOP_FIT|BOTTOM_FIT, 185 | XY_FIT = X_FIT|Y_FIT, 186 | }; 187 | 188 | struct DlgItem { 189 | DWORD flags; // DlgItemFlags 190 | HWND hWnd; 191 | WINPOS wpos; 192 | }; 193 | 194 | // UTF8 string class 195 | enum StrMode { BY_UTF8, BY_MBCS }; 196 | 197 | class THashTbl; 198 | 199 | class THashObj { 200 | public: 201 | THashObj *priorHash; 202 | THashObj *nextHash; 203 | u_int hashId; 204 | 205 | public: 206 | THashObj() { priorHash = nextHash = NULL; hashId = 0; } 207 | virtual ~THashObj() { if (priorHash && priorHash != this) UnlinkHash(); } 208 | 209 | virtual BOOL LinkHash(THashObj *top); 210 | virtual BOOL UnlinkHash(); 211 | friend THashTbl; 212 | }; 213 | 214 | class THashTbl { 215 | protected: 216 | THashObj *hashTbl; 217 | int hashNum; 218 | int registerNum; 219 | BOOL isDeleteObj; 220 | 221 | virtual BOOL IsSameVal(THashObj *, const void *val) = 0; 222 | 223 | public: 224 | THashTbl(int _hashNum=0, BOOL _isDeleteObj=TRUE); 225 | virtual ~THashTbl(); 226 | virtual BOOL Init(int _hashNum); 227 | virtual void UnInit(); 228 | virtual void Register(THashObj *obj, u_int hash_id); 229 | virtual void UnRegister(THashObj *obj); 230 | virtual THashObj *Search(const void *data, u_int hash_id); 231 | virtual int GetRegisterNum() { return registerNum; } 232 | // virtual u_int MakeHashId(const void *data) = 0; 233 | }; 234 | 235 | /* for internal use start */ 236 | struct TResHashObj : THashObj { 237 | void *val; 238 | TResHashObj(UINT _resId, void *_val) { hashId = _resId; val = _val; } 239 | ~TResHashObj() { free(val); } 240 | 241 | }; 242 | 243 | class TResHash : public THashTbl { 244 | protected: 245 | virtual BOOL IsSameVal(THashObj *obj, const void *val) { 246 | return obj->hashId == *(u_int *)val; 247 | } 248 | 249 | public: 250 | TResHash(int _hashNum) : THashTbl(_hashNum) {} 251 | TResHashObj *Search(UINT resId) { return (TResHashObj *)THashTbl::Search(&resId, resId); } 252 | void Register(TResHashObj *obj) { THashTbl::Register(obj, obj->hashId); } 253 | }; 254 | /* for internal use end */ 255 | 256 | class TWin : public THashObj { 257 | protected: 258 | RECT rect; 259 | RECT orgRect; 260 | HACCEL hAccel; 261 | TWin *parent; 262 | BOOL sleepBusy; // for TWin::Sleep() only 263 | 264 | public: 265 | TWin(TWin *_parent = NULL); 266 | virtual ~TWin(); 267 | 268 | HWND hWnd; 269 | 270 | virtual void Show(int mode = SW_SHOWDEFAULT); 271 | virtual BOOL Create(LPCSTR className=NULL, LPCSTR title="", 272 | DWORD style=(WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN), 273 | DWORD exStyle=0, HMENU hMenu=NULL); 274 | virtual BOOL CreateU8(LPCSTR className=NULL, LPCSTR title="", 275 | DWORD style=(WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN), 276 | DWORD exStyle=0, HMENU hMenu=NULL); 277 | virtual BOOL CreateV(const void *className=NULL, const void *title=L"", 278 | DWORD style=(WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN), 279 | DWORD exStyle=0, HMENU hMenu=NULL); 280 | virtual void Destroy(void); 281 | 282 | virtual BOOL EvCommand(WORD wNotifyCode, WORD wID, LPARAM hwndCtl); 283 | virtual BOOL EvSysCommand(WPARAM uCmdType, POINTS pos); 284 | virtual BOOL EvCreate(LPARAM lParam); 285 | virtual BOOL EvClose(void); 286 | virtual BOOL EvNcDestroy(void); 287 | virtual BOOL EvQueryEndSession(BOOL nSession, BOOL nLogOut); 288 | virtual BOOL EvEndSession(BOOL nSession, BOOL nLogOut); 289 | virtual BOOL EvQueryOpen(void); 290 | virtual BOOL EvPaint(void); 291 | virtual BOOL EvNcPaint(HRGN hRgn); 292 | virtual BOOL EvSize(UINT fwSizeType, WORD nWidth, WORD nHeight); 293 | virtual BOOL EvShowWindow(BOOL fShow, int fnStatus); 294 | virtual BOOL EvGetMinMaxInfo(MINMAXINFO *info); 295 | virtual BOOL EvTimer(WPARAM timerID, TIMERPROC proc); 296 | virtual BOOL EvSetCursor(HWND cursorWnd, WORD nHitTest, WORD wMouseMsg); 297 | virtual BOOL EvMouseMove(UINT fwKeys, POINTS pos); 298 | virtual BOOL EvNcHitTest(POINTS pos, LRESULT *result); 299 | virtual BOOL EvMeasureItem(UINT ctlID, MEASUREITEMSTRUCT *lpMis); 300 | virtual BOOL EvDrawItem(UINT ctlID, DRAWITEMSTRUCT *lpDis); 301 | virtual BOOL EvMenuSelect(UINT uItem, UINT fuFlag, HMENU hMenu); 302 | virtual BOOL EvDropFiles(HDROP hDrop); 303 | virtual BOOL EvNotify(UINT ctlID, NMHDR *pNmHdr); 304 | virtual BOOL EvContextMenu(HWND childWnd, POINTS pos); 305 | virtual BOOL EvHotKey(int hotKey); 306 | 307 | virtual BOOL EventActivateApp(BOOL fActivate, DWORD dwThreadID); 308 | virtual BOOL EventActivate(BOOL fActivate, DWORD fMinimized, HWND hActiveWnd); 309 | virtual BOOL EventScroll(UINT uMsg, int nCode, int nPos, HWND scrollBar); 310 | 311 | virtual BOOL EventButton(UINT uMsg, int nHitTest, POINTS pos); 312 | virtual BOOL EventKey(UINT uMsg, int nVirtKey, LONG lKeyData); 313 | virtual BOOL EventInitMenu(UINT uMsg, HMENU hMenu, UINT uPos, BOOL fSystemMenu); 314 | virtual BOOL EventCtlColor(UINT uMsg, HDC hDcCtl, HWND hWndCtl, HBRUSH *result); 315 | virtual BOOL EventFocus(UINT uMsg, HWND focusWnd); 316 | virtual BOOL EventSystem(UINT uMsg, WPARAM wParam, LPARAM lParam); 317 | virtual BOOL EventUser(UINT uMsg, WPARAM wParam, LPARAM lParam); 318 | 319 | virtual UINT GetDlgItemText(int ctlId, LPSTR buf, int len); 320 | virtual UINT GetDlgItemTextV(int ctlId, void *buf, int len); 321 | virtual UINT GetDlgItemTextU8(int ctlId, char *buf, int len); 322 | virtual BOOL SetDlgItemText(int ctlId, LPCSTR buf); 323 | virtual BOOL SetDlgItemTextV(int ctlId, const void *buf); 324 | virtual BOOL SetDlgItemTextU8(int ctlId, const char *buf); 325 | virtual int GetDlgItemInt(int ctlId, BOOL *err=NULL, BOOL sign=TRUE); 326 | virtual BOOL SetDlgItemInt(int ctlId, int val, BOOL sign=TRUE); 327 | virtual HWND GetDlgItem(int ctlId); 328 | virtual BOOL CheckDlgButton(int ctlId, UINT check); 329 | virtual UINT IsDlgButtonChecked(int ctlId); 330 | virtual BOOL IsWindowVisible(void); 331 | virtual BOOL EnableWindow(BOOL is_enable); 332 | 333 | virtual int MessageBox(LPCSTR msg, LPCSTR title="msg", UINT style=MB_OK); 334 | virtual int MessageBoxV(void *msg, void *title=EMPTY_STR_V, UINT style=MB_OK); 335 | virtual int MessageBoxU8(char *msg, char *title="msg", UINT style=MB_OK); 336 | virtual BOOL BringWindowToTop(void); 337 | virtual BOOL SetForegroundWindow(void); 338 | virtual BOOL SetForceForegroundWindow(void); 339 | virtual BOOL ShowWindow(int mode); 340 | virtual BOOL PostMessage(UINT uMsg, WPARAM wParam, LPARAM lParam); 341 | virtual BOOL PostMessageW(UINT uMsg, WPARAM wParam, LPARAM lParam); 342 | virtual BOOL PostMessageV(UINT uMsg, WPARAM wParam, LPARAM lParam); 343 | virtual LRESULT SendMessage(UINT uMsg, WPARAM wParam, LPARAM lParam); 344 | virtual LRESULT SendMessageW(UINT uMsg, WPARAM wParam, LPARAM lParam); 345 | virtual LRESULT SendMessageV(UINT uMsg, WPARAM wParam, LPARAM lParam); 346 | virtual LRESULT SendDlgItemMessage(int ctlId, UINT uMsg, WPARAM wParam, LPARAM lParam); 347 | virtual LRESULT SendDlgItemMessageW(int ctlId, UINT uMsg, WPARAM wParam, LPARAM lParam); 348 | virtual LRESULT SendDlgItemMessageV(int ctlId, UINT uMsg, WPARAM wParam, LPARAM lParam); 349 | virtual BOOL GetWindowRect(RECT *_rect=NULL); 350 | virtual BOOL SetWindowPos(HWND hInsAfter, int x, int y, int cx, int cy, UINT fuFlags); 351 | virtual HWND SetActiveWindow(void); 352 | virtual int GetWindowText(LPSTR text, int size); 353 | virtual BOOL SetWindowText(LPCSTR text); 354 | virtual BOOL GetWindowTextV(void *text, int size); 355 | virtual BOOL GetWindowTextU8(char *text, int size); 356 | virtual BOOL SetWindowTextV(const void *text); 357 | virtual BOOL SetWindowTextU8(const char *text); 358 | virtual int GetWindowTextLengthV(void); 359 | virtual int GetWindowTextLengthU8(void); 360 | 361 | virtual LONG_PTR SetWindowLong(int index, LONG_PTR val); 362 | virtual WORD SetWindowWord(int index, WORD val); 363 | virtual LONG_PTR GetWindowLong(int index); 364 | virtual WORD GetWindowWord(int index); 365 | virtual TWin *GetParent(void) { return parent; }; 366 | virtual void SetParent(TWin *_parent) { parent = _parent; }; 367 | virtual BOOL MoveWindow(int x, int y, int cx, int cy, int bRepaint); 368 | virtual BOOL Sleep(UINT mSec); 369 | virtual BOOL Idle(void); 370 | virtual RECT *Rect() { return ▭ } 371 | 372 | virtual BOOL PreProcMsg(MSG *msg); 373 | virtual LRESULT WinProc(UINT uMsg, WPARAM wParam, LPARAM lParam); 374 | virtual LRESULT DefWindowProc(UINT uMsg, WPARAM wParam, LPARAM lParam); 375 | }; 376 | 377 | class TDlg : public TWin { 378 | protected: 379 | UINT resId; 380 | BOOL modalFlg; 381 | int maxItems; 382 | DlgItem *dlgItems; 383 | UINT taskbarButtonCreatedMessage; 384 | 385 | public: 386 | TDlg(UINT resid=0, TWin *_parent = NULL); 387 | virtual ~TDlg(); 388 | 389 | virtual BOOL Create(HINSTANCE hI = NULL); 390 | virtual void Destroy(void); 391 | virtual int Exec(void); 392 | virtual void EndDialog(int); 393 | UINT ResId(void) { return resId; } 394 | virtual int SetDlgItem(UINT ctl_id, DWORD flags=0); 395 | virtual BOOL FitDlgItems(); 396 | 397 | virtual BOOL EvCreate(LPARAM lParam); 398 | virtual BOOL EvCommand(WORD wNotifyCode, WORD wID, LPARAM hwndCtl); 399 | virtual BOOL EvSysCommand(WPARAM uCmdType, POINTS pos); 400 | virtual BOOL EvQueryOpen(void); 401 | virtual BOOL EvTaskbarButtonCreated(); 402 | 403 | virtual BOOL PreProcMsg(MSG *msg); 404 | virtual LRESULT WinProc(UINT uMsg, WPARAM wParam, LPARAM lParam); 405 | }; 406 | 407 | class TSubClass : public TWin { 408 | protected: 409 | WNDPROC oldProc; 410 | 411 | public: 412 | TSubClass(TWin *_parent = NULL); 413 | virtual ~TSubClass(); 414 | 415 | virtual BOOL AttachWnd(HWND _hWnd); 416 | virtual BOOL DetachWnd(); 417 | virtual LRESULT DefWindowProc(UINT uMsg, WPARAM wParam, LPARAM lParam); 418 | }; 419 | 420 | class TSubClassCtl : public TSubClass { 421 | protected: 422 | public: 423 | TSubClassCtl(TWin *_parent); 424 | 425 | virtual BOOL PreProcMsg(MSG *msg); 426 | }; 427 | 428 | BOOL TRegisterClass(LPCSTR class_name, UINT style=CS_DBLCLKS, HICON hIcon=0, HCURSOR hCursor=0, 429 | HBRUSH hbrBackground=0, int classExtra=0, int wndExtra=0, LPCSTR menu_str=0); 430 | BOOL TRegisterClassU8(LPCSTR class_name, UINT style=CS_DBLCLKS, HICON hIcon=0, HCURSOR hCursor=0, 431 | HBRUSH hbrBackground=0, int classExtra=0, int wndExtra=0, LPCSTR menu_str=0); 432 | BOOL TRegisterClassV(const void *class_name, UINT style=CS_DBLCLKS, HICON hIcon=0, 433 | HCURSOR hCursor=0, HBRUSH hbrBackground=0, int classExtra=0, int wndExtra=0, 434 | const void *menu_str=0); 435 | 436 | class TWinHashTbl : public THashTbl { 437 | protected: 438 | virtual BOOL IsSameVal(THashObj *obj, const void *val) { 439 | return ((TWin *)obj)->hWnd == *(HWND *)val; 440 | } 441 | 442 | public: 443 | TWinHashTbl(int _hashNum) : THashTbl(_hashNum) {} 444 | ~TWinHashTbl() {} 445 | 446 | u_int MakeHashId(HWND hWnd) { return (u_int)hWnd * 0xf3f77d13; } 447 | }; 448 | 449 | class TApp { 450 | protected: 451 | static TApp *tapp; 452 | TWinHashTbl *hash; 453 | LPCSTR defaultClass; 454 | LPCVOID defaultClassV; 455 | 456 | LPSTR cmdLine; 457 | int nCmdShow; 458 | TWin *mainWnd; 459 | TWin *preWnd; 460 | HINSTANCE hI; 461 | 462 | TWin *SearchWnd(HWND hWnd) { return (TWin *)hash->Search(&hWnd, hash->MakeHashId(hWnd)); } 463 | virtual BOOL InitApp(void); 464 | 465 | public: 466 | TApp(HINSTANCE _hI, LPSTR _cmdLine, int _nCmdShow); 467 | virtual ~TApp(); 468 | virtual void InitWindow() = 0; 469 | virtual int Run(); 470 | virtual BOOL PreProcMsg(MSG *msg); 471 | 472 | LPCSTR GetDefaultClass() { return defaultClass; } 473 | LPCVOID GetDefaultClassV() { return (void *)defaultClassV; } 474 | void AddWin(TWin *win) { preWnd = win; } 475 | void AddWinByWnd(TWin *win, HWND hWnd) { 476 | win->hWnd = hWnd; hash->Register(win, hash->MakeHashId(hWnd)); 477 | } 478 | void DelWin(TWin *win) { hash->UnRegister(win); } 479 | 480 | static TApp *GetApp() { return tapp; } 481 | static HINSTANCE GetInstance() { return tapp->hI; } 482 | static LRESULT CALLBACK WinProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam); 483 | }; 484 | 485 | struct TListObj { 486 | TListObj *prior, *next; 487 | }; 488 | 489 | class TList { 490 | protected: 491 | TListObj top; 492 | 493 | public: 494 | TList(void); 495 | void Init(void); 496 | void AddObj(TListObj *obj); 497 | void DelObj(TListObj *obj); 498 | TListObj *TopObj(void); 499 | TListObj *NextObj(TListObj *obj); 500 | BOOL IsEmpty() { return top.next == ⊤ } 501 | void MoveList(TList *from_list); 502 | }; 503 | 504 | #define FREE_LIST 0 505 | #define USED_LIST 1 506 | #define RLIST_MAX 2 507 | class TRecycleList { 508 | protected: 509 | char *data; 510 | TList list[RLIST_MAX]; 511 | 512 | public: 513 | TRecycleList(int init_cnt, int size); 514 | ~TRecycleList(); 515 | TListObj *GetObj(int list_type); 516 | void PutObj(int list_type, TListObj *obj); 517 | }; 518 | 519 | #define MAX_KEYARRAY 30 520 | 521 | class TRegistry { 522 | protected: 523 | HKEY topKey; 524 | int openCnt; 525 | StrMode strMode; 526 | HKEY hKey[MAX_KEYARRAY]; 527 | 528 | public: 529 | TRegistry(LPCSTR company, LPSTR appName=NULL, StrMode mode=BY_UTF8); 530 | TRegistry(LPCWSTR company, LPCWSTR appName=NULL, StrMode mode=BY_UTF8); 531 | TRegistry(HKEY top_key, StrMode mode=BY_UTF8); 532 | ~TRegistry(); 533 | 534 | void ChangeTopKey(HKEY topKey); 535 | void SetStrMode(StrMode mode) { strMode = mode; } 536 | 537 | BOOL ChangeApp(LPCSTR company, LPSTR appName=NULL); 538 | BOOL ChangeAppV(const void *company, const void *appName=NULL); 539 | 540 | BOOL OpenKey(LPCSTR subKey, BOOL createFlg=FALSE); 541 | BOOL OpenKeyV(const void *subKey, BOOL createFlg=FALSE); 542 | 543 | BOOL CreateKey(LPCSTR subKey) { return OpenKey(subKey, TRUE); } 544 | BOOL CreateKeyV(const void *subKey) { return OpenKeyV(subKey, TRUE); } 545 | 546 | BOOL CloseKey(void); 547 | 548 | BOOL GetInt(LPCSTR key, int *val); 549 | BOOL GetIntV(const void *key, int *val); 550 | 551 | BOOL SetInt(LPCSTR key, int val); 552 | BOOL SetIntV(const void *key, int val); 553 | 554 | BOOL GetLong(LPCSTR key, long *val); 555 | BOOL GetLongV(const void *key, long *val); 556 | 557 | BOOL SetLong(LPCSTR key, long val); 558 | BOOL SetLongV(const void *key, long val); 559 | 560 | BOOL GetStr(LPCSTR key, LPSTR str, int size_byte); 561 | BOOL GetStrA(LPCSTR key, LPSTR str, int size_byte); 562 | BOOL GetStrV(const void *key, void *str, int size_byte); 563 | 564 | BOOL SetStr(LPCSTR key, LPCSTR str); 565 | BOOL SetStrA(LPCSTR key, LPCSTR str); 566 | BOOL SetStrV(const void *key, const void *str); 567 | 568 | BOOL GetByte(LPCSTR key, BYTE *data, int *size); 569 | BOOL GetByteV(const void *key, BYTE *data, int *size); 570 | 571 | BOOL SetByte(LPCSTR key, const BYTE *data, int size); 572 | BOOL SetByteV(const void *key, const BYTE *data, int size); 573 | 574 | BOOL DeleteKey(LPCSTR str); 575 | BOOL DeleteKeyV(const void *str); 576 | 577 | BOOL DeleteValue(LPCSTR str); 578 | BOOL DeleteValueV(const void *str); 579 | 580 | BOOL EnumKey(DWORD cnt, LPSTR buf, int size); 581 | BOOL EnumKeyV(DWORD cnt, void *buf, int size); 582 | 583 | BOOL EnumValue(DWORD cnt, LPSTR buf, int size, DWORD *type=NULL); 584 | BOOL EnumValueV(DWORD cnt, void *buf, int size, DWORD *type=NULL); 585 | 586 | BOOL DeleteChildTree(LPCSTR subkey=NULL); 587 | BOOL DeleteChildTreeV(const void *subkey=NULL); 588 | }; 589 | 590 | class TIniKey : public TListObj { 591 | protected: 592 | char *key; // null means comment line 593 | char *val; 594 | 595 | public: 596 | TIniKey(const char *_key=NULL, const char *_val=NULL) { 597 | key = val = NULL; if (_key || _val) Set(_key, _val); 598 | } 599 | ~TIniKey() { free(key); free(val); } 600 | 601 | void Set(const char *_key=NULL, const char *_val=NULL) { 602 | if (_key) { free(key); key=strdup(_key); } 603 | if (_val) { free(val); val=strdup(_val); } 604 | } 605 | const char *Key() { return key; } 606 | const char *Val() { return val; } 607 | }; 608 | 609 | class TIniSection : public TListObj, public TList { 610 | protected: 611 | char *name; 612 | 613 | public: 614 | TIniSection() { name = NULL; } 615 | ~TIniSection() { 616 | free(name); 617 | for (TIniKey *key; (key = (TIniKey *)TopObj()); ) { 618 | DelObj(key); 619 | delete key; 620 | } 621 | } 622 | 623 | void Set(const char *_name=NULL) { 624 | if (_name) { free(name); name=strdup(_name); } 625 | } 626 | TIniKey *SearchKey(const char *key_name) { 627 | for (TIniKey *key = (TIniKey *)TopObj(); key; key = (TIniKey *)NextObj(key)) { 628 | if (key->Key() && strcmpi(key->Key(), key_name) == 0) return key; 629 | } 630 | return NULL; 631 | } 632 | BOOL AddKey(const char *key_name, const char *val) { 633 | TIniKey *key = key_name ? SearchKey(key_name) : NULL; 634 | if (!key) { 635 | key = new TIniKey(key_name, val); 636 | AddObj(key); 637 | } 638 | else { 639 | key->Set(NULL, val); 640 | } 641 | return TRUE; 642 | } 643 | BOOL DelKey(const char *key_name) { 644 | TIniKey *key = SearchKey(key_name); 645 | if (!key) return FALSE; 646 | DelObj(key); 647 | delete key; 648 | return TRUE; 649 | } 650 | const char *Name() { return name; } 651 | }; 652 | 653 | class TInifile: public TList { 654 | protected: 655 | char *ini_file; 656 | TIniSection *cur_sec; 657 | TIniSection *root_sec; 658 | FILETIME ini_ft; 659 | int ini_size; 660 | HANDLE hMutex; 661 | 662 | BOOL Strip(const char *s, char *d=NULL, const char *strip_chars=" \t\r\n", 663 | const char *quote_chars="\"\""); 664 | BOOL Parse(const char *buf, BOOL *is_section, char *name, char *val); 665 | BOOL GetFileInfo(const char *fname, FILETIME *ft, int *size); 666 | TIniSection *SearchSection(const char *section); 667 | BOOL WriteIni(); 668 | BOOL Lock(); 669 | void UnLock(); 670 | 671 | public: 672 | TInifile(const char *ini_name=NULL); 673 | ~TInifile(); 674 | void Init(const char *ini_name=NULL); 675 | void UnInit(); 676 | void SetSection(const char *section); 677 | BOOL StartUpdate(); 678 | BOOL EndUpdate(); 679 | BOOL SetStr(const char *key, const char *val); 680 | DWORD GetStr(const char *key, char *val, int max_size, const char *default_val=""); 681 | BOOL SetInt(const char *key, int val); 682 | BOOL DelSection(const char *section); 683 | BOOL DelKey(const char *key); 684 | int GetInt(const char *key, int default_val=-1); 685 | const char *GetIniFileName(void) { return ini_file; } 686 | }; 687 | 688 | 689 | void InitInstanceForLoadStr(HINSTANCE hI); 690 | LPSTR GetLoadStrA(UINT resId, HINSTANCE hI=NULL); 691 | LPSTR GetLoadStrU8(UINT resId, HINSTANCE hI=NULL); 692 | LPWSTR GetLoadStrW(UINT resId, HINSTANCE hI=NULL); 693 | void TSetDefaultLCID(LCID id=0); 694 | HMODULE TLoadLibrary(LPSTR dllname); 695 | HMODULE TLoadLibraryV(void *dllname); 696 | int MakePath(char *dest, const char *dir, const char *file); 697 | int MakePathW(WCHAR *dest, const WCHAR *dir, const WCHAR *file); 698 | WCHAR lGetCharIncW(const WCHAR **str); 699 | WCHAR lGetCharIncA(const char **str); 700 | WCHAR lGetCharW(const WCHAR *str, int); 701 | WCHAR lGetCharA(const char *str, int); 702 | void lSetCharW(WCHAR *str, int offset, WCHAR ch); 703 | void lSetCharA(char *str, int offset, WCHAR ch); 704 | 705 | _int64 hex2ll(char *buf); 706 | int bin2hexstr(const BYTE *bindata, int len, char *buf); 707 | int bin2hexstrW(const BYTE *bindata, int len, WCHAR *buf); 708 | int bin2hexstr_bigendian(const BYTE *bin, int len, char *buf); 709 | BOOL hexstr2bin(const char *buf, BYTE *bindata, int maxlen, int *len); 710 | BOOL hexstr2bin_bigendian(const char *buf, BYTE *bindata, int maxlen, int *len); 711 | 712 | char *strdupNew(const char *_s); 713 | WCHAR *wcsdupNew(const WCHAR *_s); 714 | 715 | int strncmpi(const char *str1, const char *str2, int num); 716 | char *strncpyz(char *dest, const char *src, int num); 717 | 718 | BOOL TIsWow64(); 719 | BOOL TRegEnableReflectionKey(HKEY hBase); 720 | BOOL TRegDisableReflectionKey(HKEY hBase); 721 | BOOL TWow64DisableWow64FsRedirection(void *oldval); 722 | BOOL TWow64RevertWow64FsRedirection(void *oldval); 723 | BOOL TIsUserAnAdmin(); 724 | BOOL TIsEnableUAC(); 725 | BOOL TSHGetSpecialFolderPathV(HWND, void *, int, BOOL); 726 | BOOL TIsVirtualizedDirV(void *path); 727 | BOOL TMakeVirtualStorePathV(void *org_path, void *buf); 728 | BOOL TSetPrivilege(LPSTR pszPrivilege, BOOL bEnable); 729 | BOOL TSetThreadLocale(int lcid); 730 | BOOL TChangeWindowMessageFilter(UINT msg, DWORD flg); 731 | 732 | BOOL InstallExceptionFilter(char *title, char *info); 733 | void Debug(char *fmt,...); 734 | void DebugW(WCHAR *fmt,...); 735 | void DebugU8(char *fmt,...); 736 | 737 | BOOL SymLinkV(void *src, void *dest, void *arg=L""); 738 | BOOL ReadLinkV(void *src, void *dest, void *arg=NULL); 739 | BOOL DeleteLinkV(void *path); 740 | BOOL GetParentDirV(const void *srcfile, void *dir); 741 | HWND ShowHelpV(HWND hOwner, void *help_dir, void *help_file, void *section=NULL); 742 | 743 | #include "tapi32u8.h" 744 | 745 | #endif 746 | -------------------------------------------------------------------------------- /src/tlib/tlist.cpp: -------------------------------------------------------------------------------- 1 | static char *tlist_id = 2 | "@(#)Copyright (C) 1996-2009 H.Shirouzu tlist.cpp Ver0.97"; 3 | /* ======================================================================== 4 | Project Name : Win32 Lightweight Class Library Test 5 | Module Name : List Class 6 | Create : 1996-06-01(Sat) 7 | Update : 2009-03-09(Mon) 8 | Copyright : H.Shirouzu 9 | Reference : 10 | ======================================================================== */ 11 | 12 | #include "tlib.h" 13 | 14 | /* 15 | TList class 16 | */ 17 | TList::TList(void) 18 | { 19 | Init(); 20 | } 21 | 22 | void TList::Init(void) 23 | { 24 | top.prior = top.next = ⊤ 25 | } 26 | 27 | void TList::AddObj(TListObj * obj) 28 | { 29 | obj->prior = top.prior; 30 | obj->next = ⊤ 31 | top.prior->next = obj; 32 | top.prior = obj; 33 | } 34 | 35 | void TList::DelObj(TListObj * obj) 36 | { 37 | // if (!obj->next || !obj->prior || obj->next != &top && obj->prior != &top) { 38 | // Debug("DelObj(%p) (%p/%p)\n", obj, obj->next, obj->prior); 39 | // } 40 | if (obj->next) { 41 | obj->next->prior = obj->prior; 42 | } 43 | if (obj->prior) { 44 | obj->prior->next = obj->next; 45 | } 46 | obj->next = obj->prior = NULL; 47 | } 48 | 49 | TListObj* TList::TopObj(void) 50 | { 51 | // if (top.next != &top && top.next->next != &top && top.next->prior != &top) { 52 | // Debug("TopObj(%p) \n", top.next); 53 | // } 54 | return top.next == &top ? NULL : top.next; 55 | } 56 | 57 | TListObj* TList::NextObj(TListObj *obj) 58 | { 59 | return obj->next == &top ? NULL : obj->next; 60 | } 61 | 62 | void TList::MoveList(TList *from_list) 63 | { 64 | if (from_list->top.next != &from_list->top) { // from_list is not empty 65 | if (top.next == &top) { // empty 66 | top = from_list->top; 67 | top.next->prior = top.prior->next = ⊤ 68 | } 69 | else { 70 | top.prior->next = from_list->top.next; 71 | from_list->top.next->prior = top.prior; 72 | from_list->top.prior->next = ⊤ 73 | top.prior = from_list->top.prior; 74 | } 75 | from_list->Init(); 76 | } 77 | } 78 | 79 | /* 80 | TRecycleList class 81 | */ 82 | TRecycleList::TRecycleList(int init_cnt, int size) 83 | { 84 | data = new char [init_cnt * size]; 85 | memset(data, 0, init_cnt * size); 86 | 87 | for (int cnt=0; cnt < init_cnt; cnt++) { 88 | TListObj *obj = (TListObj *)(data + cnt * size); 89 | list[FREE_LIST].AddObj(obj); 90 | } 91 | } 92 | 93 | TRecycleList::~TRecycleList() 94 | { 95 | delete [] data; 96 | } 97 | 98 | TListObj *TRecycleList::GetObj(int list_type) 99 | { 100 | TListObj *obj = list[list_type].TopObj(); 101 | 102 | if (obj) 103 | list[list_type].DelObj(obj); 104 | 105 | return obj; 106 | } 107 | 108 | void TRecycleList::PutObj(int list_type, TListObj *obj) 109 | { 110 | list[list_type].AddObj(obj); 111 | } 112 | 113 | -------------------------------------------------------------------------------- /src/tlib/tmisc.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/laurent22/fastcopy/96b6c6b236a53763c3a011aae78d3be6f8bc3c85/src/tlib/tmisc.cpp -------------------------------------------------------------------------------- /src/tlib/tregist.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/laurent22/fastcopy/96b6c6b236a53763c3a011aae78d3be6f8bc3c85/src/tlib/tregist.cpp -------------------------------------------------------------------------------- /src/tlib/twin.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/laurent22/fastcopy/96b6c6b236a53763c3a011aae78d3be6f8bc3c85/src/tlib/twin.cpp -------------------------------------------------------------------------------- /src/utility.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/laurent22/fastcopy/96b6c6b236a53763c3a011aae78d3be6f8bc3c85/src/utility.cpp -------------------------------------------------------------------------------- /src/utility.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/laurent22/fastcopy/96b6c6b236a53763c3a011aae78d3be6f8bc3c85/src/utility.h -------------------------------------------------------------------------------- /src/version.cpp: -------------------------------------------------------------------------------- 1 | static char *version_id = 2 | "@(#)Copyright (C) 2004-2012 H.Shirouzu Version.cpp ver2.09"; 3 | /* ======================================================================== 4 | Project Name : Fast/Force copy file and directory 5 | Module Name : Version 6 | Create : 2010-06-13(Sun) 7 | Update : 2011-02-06(Sun) 8 | Copyright : H.Shirouzu 9 | Reference : 10 | ======================================================================== */ 11 | 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include "tlib/tlib.h" 17 | #include "version.h" 18 | 19 | static char version_str[32]; 20 | static char copyright_str[128]; 21 | 22 | void SetVersionStr(BOOL is_runas) 23 | { 24 | sprintf(version_str, "%.20s%.10s", strstr(version_id, "ver"), 25 | is_runas && TIsUserAnAdmin() ? " (Admin)" : ""); 26 | } 27 | 28 | const char *GetVersionStr() 29 | { 30 | if (version_str[0] == 0) 31 | SetVersionStr(); 32 | return version_str; 33 | } 34 | 35 | const char *GetCopyrightStr(void) 36 | { 37 | if (copyright_str[0] == 0) { 38 | char *s = strchr(version_id, 'C'); 39 | char *e = strchr(version_id, '\t'); 40 | if (s && e && s < e) { 41 | sprintf(copyright_str, "%.*s", e-s, s); 42 | } 43 | } 44 | return copyright_str; 45 | } 46 | 47 | -------------------------------------------------------------------------------- /src/version.h: -------------------------------------------------------------------------------- 1 | /*static char *version_id = 2 | "@(#)Copyright (C) 20004-2011 H.Shirouzu version.cpp ver2.07"; 3 | /* ======================================================================== 4 | Project Name : Fast/Force copy file and directory 5 | Module Name : Version 6 | Create : 2010-06-13(Sun) 7 | Update : 2011-02-06(Sun) 8 | Copyright : H.Shirouzu 9 | Reference : 10 | ======================================================================== */ 11 | 12 | #ifndef VERSION_H 13 | #define VERSION_H 14 | 15 | void SetVersionStr(BOOL is_runas=FALSE); 16 | const char *GetVersionStr(); 17 | const char *GetCopyrightStr(void); 18 | 19 | #endif 20 | 21 | --------------------------------------------------------------------------------