OSDN Git Service

2507303f08c6e96bfe45650d4de8be47903ce9c4
[ffftp/ffftp.git] / updatebell.c
1 /*=============================================================================\r
2 *                                                               更新風鐸対応\r
3 *\r
4 ===============================================================================\r
5 / Copyright (C) 1997-2007 Sota. All rights reserved.\r
6 /\r
7 / Redistribution and use in source and binary forms, with or without \r
8 / modification, are permitted provided that the following conditions \r
9 / are met:\r
10 /\r
11 /  1. Redistributions of source code must retain the above copyright \r
12 /     notice, this list of conditions and the following disclaimer.\r
13 /  2. Redistributions in binary form must reproduce the above copyright \r
14 /     notice, this list of conditions and the following disclaimer in the \r
15 /     documentation and/or other materials provided with the distribution.\r
16 /\r
17 / THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR \r
18 / IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES \r
19 / OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. \r
20 / IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, \r
21 / INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, \r
22 / BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF \r
23 / USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON \r
24 / ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT \r
25 / (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF \r
26 / THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
27 /============================================================================*/\r
28 \r
29 #define  STRICT\r
30 #include <windows.h>\r
31 #include <stdio.h>\r
32 #include <stdlib.h>\r
33 #include <string.h>\r
34 #include <malloc.h>\r
35 #include <stdarg.h>\r
36 #include <windowsx.h>\r
37 #include <commctrl.h>\r
38 \r
39 #include "common.h"\r
40 \r
41 \r
42 \r
43 // SourceForge.JPによるフォーク\r
44 //#define MAIL_ADDRESS  "sota@mwa.biglobe.ne.jp"\r
45 //#define SOFTWARE              "FFFTP"\r
46 //#define MYNAME                        "曽田"\r
47 //#define MYURL                 "http://www2.biglobe.ne.jp/~sota/"\r
48 //#define INFOFILE              "http://www2.biglobe.ne.jp/~sota/product/update.inf"\r
49 // TODO: 更新の通知用のINFファイルのURL(SourceForge.JPに作成可能かどうか不明)\r
50 #define MAIL_ADDRESS    "sota@mwa.biglobe.ne.jp"\r
51 #define SOFTWARE                "FFFTP"\r
52 #define MYNAME                  "FFFTP Project"\r
53 #define MYURL                   "http://sourceforge.jp/projects/ffftp/"\r
54 #define INFOFILE                "http://www2.biglobe.ne.jp/~sota/product/update.inf"\r
55 \r
56 \r
57 /*----- 更新風鐸のローカル情報を書き込む --------------------------------------\r
58 *\r
59 *       Parameter\r
60 *               なし\r
61 *\r
62 *       Return Value\r
63 *               なし\r
64 *----------------------------------------------------------------------------*/\r
65 \r
66 void SaveUpdateBellInfo(void)\r
67 {\r
68         HKEY hKey1;\r
69         HKEY hKey2;\r
70         HKEY hKey3;\r
71         DWORD Dispos;\r
72         int Tmp;\r
73 \r
74         if(RegOpenKeyEx(HKEY_CURRENT_USER, "Software\\Upcheck", 0, KEY_CREATE_SUB_KEY, &hKey1) == ERROR_SUCCESS)\r
75         {\r
76                 if(RegCreateKeyEx(hKey1, MAIL_ADDRESS, 0, "", REG_OPTION_NON_VOLATILE, KEY_CREATE_SUB_KEY|KEY_SET_VALUE, NULL, &hKey2, &Dispos) == ERROR_SUCCESS)\r
77                 {\r
78                         RegSetValueEx(hKey2, "Author", 0, REG_SZ, MYNAME, strlen(MYNAME)+1);\r
79                         RegSetValueEx(hKey2, "InfoURL", 0, REG_SZ, INFOFILE, strlen(INFOFILE)+1);\r
80                         RegSetValueEx(hKey2, "DisplayHost", 0, REG_SZ, MYURL, strlen(MYURL)+1);\r
81 \r
82                         if(RegCreateKeyEx(hKey2, SOFTWARE, 0, "", REG_OPTION_NON_VOLATILE, KEY_CREATE_SUB_KEY|KEY_SET_VALUE, NULL, &hKey3, &Dispos) == ERROR_SUCCESS)\r
83                         {\r
84                                 Tmp = PROGRAM_VERSION_NUM;\r
85                                 RegSetValueEx(hKey3, "Build", 0, REG_DWORD, (CONST BYTE *)&Tmp, sizeof(Tmp));\r
86                                 RegSetValueEx(hKey3, "DistinctName", 0, REG_SZ, SOFTWARE, strlen(SOFTWARE)+1);\r
87 \r
88                                 RegCloseKey(hKey3);\r
89                         }\r
90                         RegCloseKey(hKey2);\r
91                 }\r
92                 RegCloseKey(hKey1);\r
93         }\r
94         return;\r
95 }\r
96 \r
97 \r