~ubuntu-branches/debian/sid/filezilla/sid

« back to all changes in this revision

Viewing changes to src/fzshellext/shellext.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Adrien Cunin
  • Date: 2009-08-20 00:38:30 UTC
  • mfrom: (1.3.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20090820003830-0prw6uzkgv06kbkh
* New upstream release (LP: #389525)
   - New feature: remote file search
   - pkg-config is now used to search for gnutls (Closes: #529822)
* Changed package descriptions, not mentioning Windows anymore
* Updated features list in package description
* Added pkg-config to the build-dependencies
* Build-Depend on libgnutls-dev version >= 2.8.3, as required by upstream
* Updated Standards-Version to 3.8.3
* debian/rules: touch magic on configure and configure.in to make sure the
  first has a more recent timestamp than the second (Closes: #529701)

Show diffs side-by-side

added added

removed removed

Lines of Context:
118
118
char GLogFile[MAX_PATH] = "";
119
119
bool GLogOn = false;
120
120
FILE* GLogHandle = NULL;
121
 
HANDLE GLogMutex;
 
121
HANDLE GLogMutex = 0;
122
122
HINSTANCE GInstance;
123
123
 
124
124
//---------------------------------------------------------------------------
157
157
                SYSTEMTIME Time;
158
158
                GetSystemTime(&Time);
159
159
 
160
 
                fprintf(GLogHandle, "[%2d/%2d/%4d %2d:%02d:%02d.%03d][%04x] %s\n",
161
 
                        Time.wDay, Time.wMonth, Time.wYear, Time.wHour, Time.wMinute,
162
 
                        Time.wSecond, Time.wMilliseconds, (unsigned int)GetCurrentThreadId(), Message);
 
160
                fprintf(GLogHandle, "[%4d-%02d-%02d %2d:%02d:%02d.%03d][%04x:%04x] %s\n",
 
161
                        Time.wYear, Time.wMonth, Time.wDay, Time.wHour, Time.wMinute,
 
162
                        Time.wSecond, Time.wMilliseconds,
 
163
                        (unsigned int)GetCurrentProcessId(), (unsigned int)GetCurrentThreadId(),
 
164
                        Message);
163
165
        }
164
166
        catch(...)
165
167
        {
243
245
        if (Reason == DLL_PROCESS_ATTACH)
244
246
        {
245
247
                GInstance = HInstance;
246
 
        }
247
 
 
248
 
        if (GRefThisDll != 0)
249
 
        {
250
 
                DEBUG_MSG("DllMain return: settings already loaded");
251
 
                return 1;
252
 
        }
253
 
 
254
 
        GLogMutex = CreateMutex(NULL, false, _T("FileZilla3DragDropExtLogMutex"));
255
 
 
256
 
        for (int Root = 0; Root <= 1; Root++)
257
 
        {
258
 
                HKEY Key;
259
 
                if (RegOpenKeyEx(Root == 0 ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER,
260
 
                        DRAG_EXT_REG_KEY, 0,
261
 
                        STANDARD_RIGHTS_READ | KEY_QUERY_VALUE | KEY_ENUMERATE_SUB_KEYS,
262
 
                        &Key) == ERROR_SUCCESS)
263
 
                {
264
 
                        unsigned long Type;
265
 
                        unsigned long Value;
266
 
                        unsigned long Size;
267
 
                        char Buf[MAX_PATH];
268
 
 
269
 
                        Size = sizeof(Value);
270
 
                        if ((RegQueryValueEx(Key, _T("Enable"), NULL, &Type,
271
 
                                reinterpret_cast<LPBYTE>(&Value), &Size) == ERROR_SUCCESS) &&
272
 
                                (Type == REG_DWORD))
273
 
                        {
274
 
                                GEnabled = (Value != 0);
275
 
                        }
276
 
 
277
 
                        Size = sizeof(Buf);
278
 
                        if ((RegQueryValueExA(Key, "LogFile", NULL, &Type,
279
 
                                reinterpret_cast<LPBYTE>(&Buf), &Size) == ERROR_SUCCESS) &&
280
 
                                (Type == REG_SZ))
281
 
                        {
282
 
                                strncpy(GLogFile, Buf, sizeof(GLogFile));
283
 
                                GLogFile[sizeof(GLogFile) - 1] = '\0';
284
 
                                GLogOn = true;
285
 
                        }
286
 
 
287
 
                        RegCloseKey(Key);
288
 
                }
289
 
        }
290
 
        DEBUG_MSG("DllMain loaded settings");
291
 
        DEBUG_MSG(GEnabled ? "DllMain enabled" : "DllMain disabled");
292
 
        LogVersion(HInstance);
293
 
 
294
 
        DEBUG_MSG("DllMain leave");
 
248
 
 
249
                if (!GLogMutex)
 
250
                        GLogMutex = CreateMutex(NULL, false, _T("FileZilla3DragDropExtLogMutex"));
 
251
 
 
252
                if (GRefThisDll != 0)
 
253
                {
 
254
                        DEBUG_MSG("DllMain return: settings already loaded");
 
255
                        return 1;
 
256
                }
 
257
 
 
258
                for (int Root = 0; Root <= 1; Root++)
 
259
                {
 
260
                        HKEY Key;
 
261
                        if (RegOpenKeyEx(Root == 0 ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER,
 
262
                                DRAG_EXT_REG_KEY, 0,
 
263
                                STANDARD_RIGHTS_READ | KEY_QUERY_VALUE | KEY_ENUMERATE_SUB_KEYS,
 
264
                                &Key) == ERROR_SUCCESS)
 
265
                        {
 
266
                                unsigned long Type;
 
267
                                unsigned long Value;
 
268
                                unsigned long Size;
 
269
                                char Buf[MAX_PATH];
 
270
 
 
271
                                Size = sizeof(Value);
 
272
                                if ((RegQueryValueEx(Key, _T("Enable"), NULL, &Type,
 
273
                                        reinterpret_cast<LPBYTE>(&Value), &Size) == ERROR_SUCCESS) &&
 
274
                                        (Type == REG_DWORD))
 
275
                                {
 
276
                                        GEnabled = (Value != 0);
 
277
                                }
 
278
 
 
279
                                Size = sizeof(Buf);
 
280
                                if ((RegQueryValueExA(Key, "LogFile", NULL, &Type,
 
281
                                        reinterpret_cast<LPBYTE>(&Buf), &Size) == ERROR_SUCCESS) &&
 
282
                                        (Type == REG_SZ))
 
283
                                {
 
284
                                        strncpy(GLogFile, Buf, sizeof(GLogFile));
 
285
                                        GLogFile[sizeof(GLogFile) - 1] = '\0';
 
286
                                        GLogOn = true;
 
287
                                }
 
288
 
 
289
                                RegCloseKey(Key);
 
290
                        }
 
291
                }
 
292
                if (GEnabled)
 
293
                {
 
294
                        DEBUG_MSG("DllMain loaded settings, extension is enabled");
 
295
                }
 
296
                else
 
297
                {
 
298
                        DEBUG_MSG("DllMain loaded settings, extension is disabled");
 
299
                }
 
300
                LogVersion(HInstance);
 
301
 
 
302
                DEBUG_MSG("DllMain leave");
 
303
        }
 
304
        else if (Reason == DLL_PROCESS_DETACH)
 
305
        {
 
306
                DEBUG_MSG("DllMain detaching process");
 
307
                if (GLogMutex)
 
308
                {
 
309
                        CloseHandle(GLogMutex);
 
310
                        GLogMutex = 0;
 
311
                }
 
312
        }
295
313
 
296
314
        return 1;   // ok
297
315
}
745
763
}
746
764
 
747
765
//---------------------------------------------------------------------------
748
 
STDMETHODIMP_(UINT) CShellExt::CopyCallback(HWND Hwnd, UINT Func, UINT Flags,
 
766
STDMETHODIMP_(UINT) CShellExt::CopyCallback(HWND Hwnd, UINT wFunc, UINT Flags,
749
767
                                                                                        LPCTSTR SrcFile, DWORD SrcAttribs, LPCTSTR DestFile, DWORD DestAttribs)
750
768
{
751
769
        UINT Result = IDYES;
756
774
                return Result;
757
775
        }
758
776
 
759
 
        if (Func != FO_COPY && Func != FO_MOVE)
 
777
        if (wFunc != FO_COPY && wFunc != FO_MOVE)
760
778
        {
761
 
                DEBUG_MSG("CShellExt::CopyCallback return: NOT copy nor move");
 
779
                char buffer[100];
 
780
                sprintf(buffer, "CShellExt::CopyCallback return: wFunc is %u, NOT FO_COPY nor FO_MOVE", (unsigned int)wFunc);
 
781
                DEBUG_MSG(buffer);
762
782
                return Result;
763
783
        }
 
784
        else if (wFunc == FO_COPY)
 
785
        {
 
786
                DEBUG_MSG("CShellExt::CopyCallback: wFunc is FO_COPY");
 
787
        }
764
788
        else
765
 
                DEBUG_MSG("CShellExt::CopyCallback: copy or move");
 
789
        {
 
790
                DEBUG_MSG("CShellExt::CopyCallback: wFunc is FO_MOVE");
 
791
        }
766
792
 
767
793
        unsigned long Ticks = GetTickCount();
768
794
        if ((Ticks - FLastTicks) < 100 && FLastTicks <= Ticks)