OSDN Git Service

Fix bugs of simultaneous connection.
[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 // IPv6対応\r
31 #include <winsock2.h>\r
32 #include <windows.h>\r
33 #include <stdio.h>\r
34 #include <stdlib.h>\r
35 #include <string.h>\r
36 #include <malloc.h>\r
37 #include <stdarg.h>\r
38 #include <windowsx.h>\r
39 #include <commctrl.h>\r
40 \r
41 #include "common.h"\r
42 \r
43 \r
44 \r
45 // SourceForge.JPによるフォーク\r
46 //#define MAIL_ADDRESS  "sota@mwa.biglobe.ne.jp"\r
47 //#define SOFTWARE              "FFFTP"\r
48 //#define MYNAME                        "曽田"\r
49 //#define MYURL                 "http://www2.biglobe.ne.jp/~sota/"\r
50 //#define INFOFILE              "http://www2.biglobe.ne.jp/~sota/product/update.inf"\r
51 // TODO: 更新の通知用のINFファイルのURL(SourceForge.JPに作成可能かどうか不明)\r
52 #define MAIL_ADDRESS    "sota@mwa.biglobe.ne.jp"\r
53 #define SOFTWARE                "FFFTP"\r
54 #define MYNAME                  "FFFTP Project"\r
55 #define MYURL                   "http://sourceforge.jp/projects/ffftp/"\r
56 #define INFOFILE                "http://www2.biglobe.ne.jp/~sota/product/update.inf"\r
57 \r
58 \r
59 /*----- 更新風鐸のローカル情報を書き込む --------------------------------------\r
60 *\r
61 *       Parameter\r
62 *               なし\r
63 *\r
64 *       Return Value\r
65 *               なし\r
66 *----------------------------------------------------------------------------*/\r
67 \r
68 void SaveUpdateBellInfo(void)\r
69 {\r
70         HKEY hKey1;\r
71         HKEY hKey2;\r
72         HKEY hKey3;\r
73         DWORD Dispos;\r
74         int Tmp;\r
75 \r
76         if(RegOpenKeyEx(HKEY_CURRENT_USER, "Software\\Upcheck", 0, KEY_CREATE_SUB_KEY, &hKey1) == ERROR_SUCCESS)\r
77         {\r
78                 if(RegCreateKeyEx(hKey1, MAIL_ADDRESS, 0, "", REG_OPTION_NON_VOLATILE, KEY_CREATE_SUB_KEY|KEY_SET_VALUE, NULL, &hKey2, &Dispos) == ERROR_SUCCESS)\r
79                 {\r
80                         RegSetValueEx(hKey2, "Author", 0, REG_SZ, MYNAME, strlen(MYNAME)+1);\r
81                         RegSetValueEx(hKey2, "InfoURL", 0, REG_SZ, INFOFILE, strlen(INFOFILE)+1);\r
82                         RegSetValueEx(hKey2, "DisplayHost", 0, REG_SZ, MYURL, strlen(MYURL)+1);\r
83 \r
84                         if(RegCreateKeyEx(hKey2, SOFTWARE, 0, "", REG_OPTION_NON_VOLATILE, KEY_CREATE_SUB_KEY|KEY_SET_VALUE, NULL, &hKey3, &Dispos) == ERROR_SUCCESS)\r
85                         {\r
86                                 Tmp = PROGRAM_VERSION_NUM;\r
87                                 RegSetValueEx(hKey3, "Build", 0, REG_DWORD, (CONST BYTE *)&Tmp, sizeof(Tmp));\r
88                                 RegSetValueEx(hKey3, "DistinctName", 0, REG_SZ, SOFTWARE, strlen(SOFTWARE)+1);\r
89 \r
90                                 RegCloseKey(hKey3);\r
91                         }\r
92                         RegCloseKey(hKey2);\r
93                 }\r
94                 RegCloseKey(hKey1);\r
95         }\r
96         return;\r
97 }\r
98 \r
99 \r