Skip to content

@miurahr /Makefile
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
A test win32 program to reproduce and check behavior of wininet.
### Generated by Winemaker 0.8.1
###
### Invocation command line was
### /usr/bin/winemaker -iwininet .
SRCDIR = .
SUBDIRS =
DLLS =
LIBS =
EXES = winetest.exe
### Common settings
CEXTRA = -mno-cygwin
CXXEXTRA = -mno-cygwin
RCEXTRA =
DEFINES =
INCLUDE_PATH =
DLL_PATH =
DLL_IMPORTS = wininet
LIBRARY_PATH =
LIBRARIES =
### winetest.exe sources and settings
winetest_exe_MODULE = winetest.exe
winetest_exe_C_SRCS =
winetest_exe_CXX_SRCS = wine_wininet_tls_test.cpp
winetest_exe_RC_SRCS =
winetest_exe_LDFLAGS = -mwindows \
-mno-cygwin
winetest_exe_ARFLAGS =
winetest_exe_DLL_PATH =
winetest_exe_DLLS = odbc32 \
ole32 \
oleaut32 \
winspool \
odbccp32
winetest_exe_LIBRARY_PATH=
winetest_exe_LIBRARIES= uuid
winetest_exe_OBJS = $(winetest_exe_C_SRCS:.c=.o) \
$(winetest_exe_CXX_SRCS:.cpp=.o) \
$(winetest_exe_RC_SRCS:.rc=.res)
### Global source lists
C_SRCS = $(winetest_exe_C_SRCS)
CXX_SRCS = $(winetest_exe_CXX_SRCS)
RC_SRCS = $(winetest_exe_RC_SRCS)
### Tools
CC = winegcc
CXX = wineg++
RC = wrc
AR = ar
### Generic targets
all: $(SUBDIRS) $(DLLS:%=%.so) $(LIBS) $(EXES)
### Build rules
.PHONY: all clean dummy
$(SUBDIRS): dummy
@cd $@ && $(MAKE)
# Implicit rules
.SUFFIXES: .cpp .rc .res
DEFINCL = $(INCLUDE_PATH) $(DEFINES) $(OPTIONS)
.c.o:
$(CC) -c $(CFLAGS) $(CEXTRA) $(DEFINCL) -o $@ $<
.cpp.o:
$(CXX) -c $(CXXFLAGS) $(CXXEXTRA) $(DEFINCL) -o $@ $<
.cxx.o:
$(CXX) -c $(CXXFLAGS) $(CXXEXTRA) $(DEFINCL) -o $@ $<
.rc.res:
$(RC) $(RCFLAGS) $(RCEXTRA) $(DEFINCL) -fo$@ $<
# Rules for cleaning
CLEAN_FILES = y.tab.c y.tab.h lex.yy.c core *.orig *.rej \
\\\#*\\\# *~ *% .\\\#*
clean:: $(SUBDIRS:%=%/__clean__) $(EXTRASUBDIRS:%=%/__clean__)
$(RM) $(CLEAN_FILES) $(RC_SRCS:.rc=.res) $(C_SRCS:.c=.o) $(CXX_SRCS:.cpp=.o)
$(RM) $(DLLS:%=%.so) $(LIBS) $(EXES) $(EXES:%=%.so)
$(SUBDIRS:%=%/__clean__): dummy
cd `dirname $@` && $(MAKE) clean
$(EXTRASUBDIRS:%=%/__clean__): dummy
-cd `dirname $@` && $(RM) $(CLEAN_FILES)
### Target specific build rules
DEFLIB = $(LIBRARY_PATH) $(LIBRARIES) $(DLL_PATH) $(DLL_IMPORTS:%=-l%)
$(winetest_exe_MODULE): $(winetest_exe_OBJS)
$(CXX) $(winetest_exe_LDFLAGS) -o $@ $(winetest_exe_OBJS) $(winetest_exe_LIBRARY_PATH) $(DEFLIB) $(winetest_exe_DLLS:%=-l%) $(winetest_exe_LIBRARIES:%=-l%)
#include <stdio.h>
#include <windows.h>
#include <wininet.h>
/* winemaker: Added -lWininet to the libraries */
int main() {
HINTERNET hInet=NULL,
hConnect=NULL,
hRequest=NULL;
DWORD dwSize=0;
DWORD dwError;
char *lpBufferA,
*lpHeadersA;
LPTSTR AcceptTypes[2] = {TEXT("*/*"), NULL};
hInet = InternetOpen(TEXT("SSLTEST"), INTERNET_OPEN_TYPE_PRECONFIG,
NULL, NULL, 0);
if (!hInet) {
printf("InternetOpen Error\n");
return -1;
}
hConnect = InternetConnect(
hInet,
TEXT("www.evernote.com"),
INTERNET_DEFAULT_HTTPS_PORT,
NULL,
NULL,
INTERNET_SERVICE_HTTP,
0,
0 );
if (!hConnect) {
printf("InternetConnect Error\n");
return -1;
}
hRequest = HttpOpenRequest (
hConnect,
TEXT("GET"),
TEXT("/"),
HTTP_VERSION,
NULL,
(LPCTSTR*)AcceptTypes,
INTERNET_FLAG_SECURE|INTERNET_FLAG_RELOAD,
0);
if (!hRequest) {
printf("HttpOpenRequest Error\n");
return -1;
}
if (!HttpSendRequest(hRequest, NULL, 0, NULL, 0)) {
dwError = GetLastError();
if (dwError == 12057) {
InternetCloseHandle(hRequest);
hRequest = HttpOpenRequest (
hConnect,
TEXT("GET"),
TEXT("/"),
HTTP_VERSION,
NULL,
(LPCTSTR*)AcceptTypes,
SECURITY_FLAG_IGNORE_REVOCATION|INTERNET_FLAG_SECURE|INTERNET_FLAG_RELOAD,
0);
HttpSendRequest(hRequest, NULL, 0, NULL, 0);
}else {
printf("HttpSendRequest Error:%d\n",dwError);
return -1;
}
}
dwSize = 256;
lpHeadersA = new CHAR [dwSize];
if (!HttpQueryInfoA(hRequest, HTTP_QUERY_STATUS_TEXT, (LPVOID)lpHeadersA, &dwSize, NULL)) {
printf("HttpQueryInfoA Error\n");
return -1;
}
lpHeadersA[dwSize] = '\0';
printf ("Header: %s\n", lpHeadersA);
dwSize = 65536;
lpBufferA = new CHAR [dwSize];
{ /* do only one time */
if(!InternetReadFile(hRequest, (LPVOID)lpBufferA, dwSize - 1, &dwSize)) {
printf("InternetReadFile Error\n");
return -1;
}
if (dwSize !=0 ){
lpBufferA[dwSize-1] = '\0';
printf("%s\n", lpBufferA);
} else {
printf("No data got\n");
}
}
delete[] lpBufferA;
InternetCloseHandle(hRequest);
InternetCloseHandle(hConnect);
InternetCloseHandle(hInet);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.