Revision 1919 trunk/client/gui/main.c

main.c (revision 1919)
170 170
    GtkTreeModel *model;
171 171
#endif
172 172

                
173
#ifdef WIN32
174
    WORD wVersionRequested;
175
    WSADATA wsaData;
176
    int ret;
177

                
178
    // Initialise Winsock
179
    wVersionRequested = MAKEWORD(2, 2);
180

                
181
    ret = WSAStartup(wVersionRequested, &wsaData);
182
    if (ret != 0) {
183
        /* Tell the user that we could not find a usable */
184
        /* WinSock DLL.                                  */
185
        g_error(_("Winsock could not be initialised"));
186
        return -1;
187
    }
188

                
189
    /* Confirm that the WinSock DLL supports 2.2.        */
190
    /* Note that if the DLL supports versions greater    */
191
    /* than 2.2 in addition to 2.2, it will still return */
192
    /* 2.2 in wVersion since that is the version we      */
193
    /* requested.                                        */
194

                
195
    if (LOBYTE( wsaData.wVersion ) != 2 ||
196
        HIBYTE( wsaData.wVersion ) != 2) {
197
        /* Tell the user that we could not find a usable */
198
        /* WinSock DLL.                                  */
199
        WSACleanup();
200

                
201
        g_error(_("Winsock 2.2 or higher is required for this program"));
202

                
203
        return -1;
204
    }
205
#endif
206

                
207 173
    gtk_widget_show(windowMain);
208 174

                
209 175
#if GTK_CHECK_VERSION(3,0,0)
... ...
387 353
    nntpgrab_glue_kill_server(glue);
388 354
}
389 355

                
390
#ifdef _MSC_VER
391
void AppInvalidParameterHandler(const wchar_t* expression, const wchar_t* function, const wchar_t* file, unsigned int line,    uintptr_t pReserved ) {
392
        fprintf(
393
                stderr,
394
                "Invalid parameter detected in function %s. File: %s Line: %d\n",
395
                function,
396
                file,
397
                line
398
        );
399
        fprintf(
400
                stderr,
401
                "Expression: %s\n",
402
                expression
403
        );
404
        // Cause a Debug Breakpoint.
405
        DebugBreak();
406
}
407
#endif
408

                
409 356
gboolean
410 357
gui_get_is_initialized()
411 358
{
... ...
607 554
    const char *plugin_dir;
608 555
#endif
609 556

                
610
#ifdef WIN32
611
#ifdef _MSC_VER
612
    _set_invalid_parameter_handler(AppInvalidParameterHandler);
613
#else
614
    // exchndl.dll is part of Dr. MinGW. By loading this DLL, every time the
615
    // program crashes a .RPT file will be created containing the backtrace
616
    LoadLibraryA("exchndl.dll");
617
#endif
618
#endif
619

                
620 557
    g_set_application_name("NNTPGrab");
621 558
    g_set_prgname("NNTPGrab");
622 559

                

Also available in: Unified diff