1 // SoftEther UT-VPN SourceCode
\r
3 // Copyright (C) 2004-2010 SoftEther Corporation.
\r
4 // Copyright (C) 2004-2010 University of Tsukuba, Japan.
\r
5 // Copyright (C) 2003-2010 Daiyuu Nobori.
\r
6 // All Rights Reserved.
\r
8 // http://utvpn.tsukuba.ac.jp/
\r
10 // This program is free software; you can redistribute it and/or
\r
11 // modify it under the terms of the GNU General Public License
\r
12 // version 2 as published by the Free Software Foundation.
\r
14 // This program is distributed in the hope that it will be useful,
\r
15 // but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
17 // GNU General Public License for more details.
\r
19 // You should have received a copy of the GNU General Public License version 2
\r
20 // along with this program; if not, write to the Free Software
\r
21 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
\r
23 // このファイルは GPL バージョン 2 ライセンスで公開されています。
\r
24 // 誰でもこのファイルの内容を複製、改変したり、改変したバージョンを再配布
\r
25 // することができます。ただし、原著作物を改変した場合は、原著作物の著作権表示
\r
26 // を除去することはできません。改変した著作物を配布する場合は、改変実施者の
\r
27 // 著作権表示を原著作物の著作権表示に付随して記載するようにしてください。
\r
29 // この SoftEther UT-VPN オープンソース・プロジェクトは、日本国の
\r
30 // ソフトイーサ株式会社 (SoftEther Corporation, http://www.softether.co.jp/ )
\r
31 // および筑波大学 (University of Tsukuba, http://www.tsukuba.ac.jp/ ) によって
\r
33 // 本プログラムの配布者は、本プログラムを、業としての利用以外のため、
\r
34 // および、試験または研究のために利用が行われることを想定して配布
\r
36 // SoftEther UT-VPN プロジェクトの Web サイトは http://utvpn.tsukuba.ac.jp/ に
\r
38 // 本ソフトウェアの不具合の修正、機能改良、セキュリティホールの修復などのコード
\r
39 // の改変を行った場合で、その成果物を SoftEther UT-VPN プロジェクトに提出して
\r
40 // いただける場合は、 http://utvpn.tsukuba.ac.jp/ までソースコードを送付して
\r
41 // ください。SoftEther UT-VPN プロジェクトの本体リリースまたはブランチリリース
\r
44 // GPL に基づいて原著作物が提供される本ソフトウェアの改良版を配布、販売する
\r
45 // 場合は、そのソースコードを GPL に基づいて誰にでも開示する義務が生じます。
\r
47 // 本ソフトウェアに関連する著作権、特許権、商標権はソフトイーサ株式会社
\r
48 // (SoftEther Corporation) およびその他の著作権保持者が保有しています。
\r
49 // ソフトイーサ株式会社等はこれらの権利を放棄していません。本ソフトウェアの
\r
50 // 二次著作物を配布、販売する場合は、これらの権利を侵害しないようにご注意
\r
53 // お願い: どのような通信ソフトウェアにも通常は必ず未発見の
\r
54 // セキュリティホールが潜んでいます。本ソースコードをご覧いただいた結果、
\r
55 // UT-VPN にセキュリティホールを発見された場合は、当該セキュリティホールの
\r
56 // 情報を不特定多数に開示される前に、必ず、ソフトイーサ株式会社
\r
57 // および脆弱性情報の届出を受け付ける公的機関まで通報いただき、
\r
58 // 公益保護にご協力いただきますようお願い申し上げます。
\r
60 // ソフトイーサ株式会社は、当該セキュリティホールについて迅速に対処を
\r
61 // 行い、UT-VPN および UT-VPN に関連するソフトウェアのユーザー・顧客
\r
64 // ソフトイーサへの届出先: http://www.softether.co.jp/jp/contact/
\r
65 // 日本国内の脆弱性情報届出受付公的機関:
\r
67 // http://www.ipa.go.jp/security/vuln/report/
\r
69 // 上記各事項について不明な点は、ソフトイーサ株式会社までご連絡ください。
\r
70 // 連絡先: http://www.softether.co.jp/jp/contact/
\r
72 // -----------------------------------------------
\r
75 // 新規リリース by SoftEther
\r
76 // -----------------------------------------------
\r
79 // Windows7用 ジャンプリスト ソースコード
\r
81 // Q. このソースコードだけ他と違ってコメントが少ないように見える。
\r
86 //#define NTDDI_WIN7 0x06010000
\r
87 //#define _WIN32_WINNT _WIN32_WINNT_VISTA
\r
88 //#define NTDDI_VERSION NTDDI_VISTA // Specifies that the minimum required platform is Windows 7.
\r
89 #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
\r
90 #define STRICT_TYPED_ITEMIDS // Utilize strictly typed IDLists
\r
92 //#include <objectarray.h>
\r
93 #include <shobjidl.h>
\r
94 #include <propkey.h>
\r
95 #include <propvarutil.h>
\r
96 //#include <knownfolders.h>
\r
97 //#include <shlobj.h>
\r
113 #define WIN32HTML_CPP
\r
115 //#define _WIN32_WINNT 0x0502
\r
116 //#define WINVER 0x0502
\r
117 #include <winsock2.h>
\r
118 #include <windows.h>
\r
119 #include <wincrypt.h>
\r
120 #include <wininet.h>
\r
121 #include <comdef.h>
\r
122 #include <Mshtmhst.h>
\r
123 //#include <shlobj.h>
\r
124 #include <commctrl.h>
\r
125 #include <Dbghelp.h>
\r
127 #include <stdlib.h>
\r
128 #include <string.h>
\r
130 #include <stdarg.h>
\r
136 #include <Mayaqua/Mayaqua.h>
\r
137 #include <Cedar/Cedar.h>
\r
139 #include "../PenCore/resource.h"
\r
144 //////////////////////////////////////////////////////////////////////////
\r
146 // 注意: このあたりのコードは Win32 ヘッダファイル等からコピーした部分がある。
\r
147 // ただしコピーしたのは単純な部分のみであり、創造的かつ複雑な部分ではないので
\r
148 // GPL のコードの一部としてペーストしてあっても問題にはならないものと解釈
\r
151 #define CREATE_PROPERTYKEY(l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8, pid) { { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }, pid }
\r
154 JL_HRESULT JL_CreateCustomDestinationList(JL_PCustomDestinationList* poc, wchar_t* appID)
\r
156 ICustomDestinationList *pcdl;
\r
158 //CLSID_DestinationList = 6332DEBF-87B5-4670-90C0-5E57-B408-A49E
\r
162 destList.Data1 = 2012286192;
\r
163 destList.Data2 = 15797;
\r
164 destList.Data3 = 18790;
\r
166 destList.Data4[0] = 181;
\r
167 destList.Data4[1] = 32;
\r
168 destList.Data4[2] = 183;
\r
169 destList.Data4[3] = 197;
\r
170 destList.Data4[4] = 79;
\r
171 destList.Data4[5] = 211;
\r
172 destList.Data4[6] = 94;
\r
173 destList.Data4[7] = 214;
\r
175 HRESULT hr = CoCreateInstance(destList,
\r
176 NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&pcdl));
\r
180 pcdl->SetAppID(appID);
\r
181 (*poc) = (void*)pcdl;
\r
191 JL_HRESULT JL_ReleaseCustomDestinationList(JL_PCustomDestinationList poc)
\r
193 ICustomDestinationList *pcdl = (ICustomDestinationList*)poc;
\r
202 JL_HRESULT JL_BeginList(JL_PCustomDestinationList poc, JL_PObjectArray* oaRemoved)
\r
205 IObjectArray *poaRemoved;
\r
207 ICustomDestinationList *pcdl = (ICustomDestinationList*)poc;
\r
209 HRESULT hr = pcdl->BeginList(&cMinSlots, IID_PPV_ARGS(&poaRemoved));
\r
211 (*oaRemoved) = poaRemoved;
\r
216 JL_HRESULT JL_CommitList(JL_PCustomDestinationList cdl)
\r
218 ICustomDestinationList *pcdl = (ICustomDestinationList*)cdl;
\r
220 return pcdl->CommitList();
\r
223 JL_HRESULT JL_CreateObjectCollection(JL_PObjectCollection* jpoc)
\r
226 //CLSID_EnumerableObjectCollection = 2D3468C1-36A7-43B6-AC24-D3F0-2FD9-607A
\r
231 enumObjCol.Data1 = 758409409;
\r
232 enumObjCol.Data2 = 13991;
\r
233 enumObjCol.Data3 = 17334;
\r
235 enumObjCol.Data4[0] = 172;
\r
236 enumObjCol.Data4[1] = 36;
\r
237 enumObjCol.Data4[2] = 211;
\r
238 enumObjCol.Data4[3] = 240;
\r
239 enumObjCol.Data4[4] = 47;
\r
240 enumObjCol.Data4[5] = 217;
\r
241 enumObjCol.Data4[6] = 96;
\r
242 enumObjCol.Data4[7] = 122;
\r
244 IObjectCollection *poc;
\r
245 HRESULT hr = CoCreateInstance(enumObjCol,
\r
246 NULL, CLSCTX_INPROC, IID_PPV_ARGS(&poc));
\r
258 JL_HRESULT JL_ReleaseObjectCollection(JL_PObjectCollection jpoc)
\r
260 IObjectCollection *poc = (IObjectCollection *)jpoc;
\r
263 return poc->Release();
\r
269 JL_HRESULT JL_ObjectCollectionAddShellLink(JL_PObjectCollection jpoc, JL_PShellLink jpsl)
\r
271 IObjectCollection *poc = (IObjectCollection *)jpoc;
\r
272 IShellLink *psl = (IShellLink *) jpsl;
\r
274 return poc->AddObject(psl);
\r
279 JL_HRESULT JL_AddCategoryToList(JL_PCustomDestinationList jpcdl,
\r
280 JL_PObjectCollection jpoc,
\r
281 wchar_t* categoryName,
\r
282 JL_PObjectArray jpoaRemoved)
\r
284 ICustomDestinationList *pcdl = (ICustomDestinationList*)jpcdl;
\r
285 IObjectCollection *poc = (IObjectCollection *)jpoc;
\r
286 IObjectArray *poaRemoved = (IObjectArray*)jpoaRemoved;
\r
289 HRESULT hr = poc->QueryInterface(IID_PPV_ARGS(&poa));
\r
293 hr = pcdl->AppendCategory(categoryName, poa);
\r
301 Print("Failed AppendCategory\n");
\r
306 Print("Failed QueryInterface\n");
\r
315 JL_HRESULT JL_CreateShellLink(
\r
317 wchar_t* pszArguments,
\r
318 wchar_t* pszTitle,
\r
319 wchar_t* iconLocation,
\r
321 wchar_t* description, JL_PShellLink *ppsl)
\r
324 HRESULT hr = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&psl));
\r
327 psl->SetPath(pszPath);
\r
328 psl->SetArguments(pszArguments);
\r
329 if(iconLocation != NULL)
\r
331 psl->SetIconLocation(iconLocation,iconIndex);
\r
334 if(description != NULL)
\r
336 psl->SetDescription(description);
\r
340 IPropertyStore *pps;
\r
341 hr = psl->QueryInterface(IID_PPV_ARGS(&pps));
\r
344 PROPVARIANT propvar;
\r
345 hr = InitPropVariantFromString(pszTitle, &propvar);
\r
349 PROPERTYKEY pkey_title =
\r
350 CREATE_PROPERTYKEY(0xF29F85E0, 0x4FF9, 0x1068, 0xAB, 0x91, 0x08, 0x00, 0x2B, 0x27, 0xB3, 0xD9, 2);
\r
352 hr = pps->SetValue(pkey_title, propvar);
\r
357 hr = pps->Commit();
\r
361 hr = psl->QueryInterface(IID_PPV_ARGS(&tpsl));
\r
365 PropVariantClear(&propvar);
\r
375 JL_HRESULT JL_ReleaseShellLink(JL_PShellLink jpsl)
\r
377 IShellLink *psl = (IShellLink *) jpsl;
\r
381 return psl->Release();
\r
387 JL_HRESULT JL_DeleteJumpList(JL_PCustomDestinationList jpcdl,wchar_t* appID)
\r
389 ICustomDestinationList *pcdl = (ICustomDestinationList *)jpcdl;
\r
391 HRESULT hr = pcdl->DeleteList(appID);
\r
399 //////////////////////////////////////////////////////////////////////////
\r
400 //SetApplicationID for Windows 7
\r
401 JL_HRESULT JL_SetCurrentProcessExplicitAppUserModelID(wchar_t* appID)
\r
404 HMODULE hModule = LoadLibraryW( L"shell32.dll");
\r
406 HMODULE hModule = LoadLibraryA( "shell32.dll");
\r
408 HRESULT (__stdcall *SetAppID) (PCWSTR);
\r
410 if( hModule == NULL )
\r
412 Print("Not Found shell32.dll");
\r
416 SetAppID = (HRESULT (__stdcall *)(PCWSTR))
\r
417 GetProcAddress( hModule, "SetCurrentProcessExplicitAppUserModelID" );
\r
418 if( SetAppID != NULL )
\r
420 FreeLibrary( hModule );
\r
421 return SetAppID(appID);
\r
425 Print("Not Found SetCurrentProcessExplicitAppUserModelID");
\r
429 FreeLibrary( hModule );
\r