--- /dev/null
+diff -crN 025win/Makefile 025linux/Makefile
+*** 025win/Makefile 1970-01-01 09:00:00.000000000 +0900
+--- 025linux/Makefile 2012-02-19 03:21:03.082870623 +0900
+***************
+*** 0 ****
+--- 1,25 ----
++ # PC/SC Lite libraries and headers.
++ PCSC_CFLAGS ?= `pkg-config libpcsclite --cflags`
++ PCSC_LDLIBS ?= `pkg-config libpcsclite --libs`
++
++ CC = gcc
++ CFLAGS = -Wall -O2 -g $(PCSC_CFLAGS) -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
++ LDLIBS = $(PCSC_LDLIBS) -lm -lrt
++
++ TARGET = b25
++ OBJS = arib_std_b25.o b_cas_card.o multi2.o td.o ts_section_parser.o
++
++ all: $(TARGET)
++
++ arib_std_b25.o: arib_std_b25.c arib_std_b25.h portable.h b_cas_card.h arib_std_b25_error_code.h multi2.h ts_section_parser.h ts_common_types.h
++ b_cas_card.o: b_cas_card.c b_cas_card.h portable.h b_cas_card_error_code.h
++ multi2.o: multi2.c multi2.h portable.h multi2_error_code.h
++ td.o: td.c arib_std_b25.h portable.h b_cas_card.h
++ ts_section_parser.o: ts_section_parser.c ts_section_parser.h ts_common_types.h portable.h ts_section_parser_error_code.h
++
++ $(TARGET): $(OBJS)
++ $(CC) $(LDLIBS) -o $(TARGET) $(OBJS)
++
++ clean:
++ rm -f *.o
++ rm -f $(TARGET)
+diff -crN 025win/arib_std_b25.c 025linux/arib_std_b25.c
+*** 025win/arib_std_b25.c 2012-02-13 02:14:17.000000000 +0900
+--- 025linux/arib_std_b25.c 2012-02-19 02:57:04.000000000 +0900
+***************
+*** 409,416 ****
+ static uint8_t *resync(uint8_t *head, uint8_t *tail, int32_t unit);\r
+ static uint8_t *resync_force(uint8_t *head, uint8_t *tail, int32_t unit);\r
+ \r
+- static uint32_t crc32(uint8_t *head, uint8_t *tail);\r
+- \r
+ /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\r
+ interface method implementation\r
+ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/\r
+--- 409,414 ----
+diff -crN 025win/b_cas_card.c 025linux/b_cas_card.c
+*** 025win/b_cas_card.c 2008-12-29 14:11:48.000000000 +0900
+--- 025linux/b_cas_card.c 2012-02-19 02:57:39.000000000 +0900
+***************
+*** 6,12 ****
+ \r
+ #include <math.h>\r
+ \r
+! #include <windows.h>\r
+ #include <winscard.h>\r
+ \r
+ /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\r
+--- 6,14 ----
+ \r
+ #include <math.h>\r
+ \r
+! #if defined(WIN32)\r
+! #include <windows.h>\r
+! #endif\r
+ #include <winscard.h>\r
+ \r
+ /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\r
+diff -crN 025win/portable.h 025linux/portable.h
+*** 025win/portable.h 2007-11-09 00:58:40.000000000 +0900
+--- 025linux/portable.h 2012-02-19 02:58:23.000000000 +0900
+***************
+*** 1,7 ****
+ #ifndef PORTABLE_H\r
+ #define PORTABLE_H\r
+ \r
+! #if (MSC_VER < 1300) \r
+ \r
+ typedef unsigned char uint8_t;\r
+ typedef signed char int8_t;\r
+--- 1,7 ----
+ #ifndef PORTABLE_H\r
+ #define PORTABLE_H\r
+ \r
+! #if (defined(WIN32) && MSC_VER < 1300) \r
+ \r
+ typedef unsigned char uint8_t;\r
+ typedef signed char int8_t;\r
+***************
+*** 18,21 ****
+--- 18,38 ----
+ \r
+ #endif\r
+ \r
++ #if !defined(WIN32)\r
++ #define _open open\r
++ #define _close close\r
++ #define _read read\r
++ #define _write write\r
++ #define _lseeki64 lseek\r
++ #define _telli64(fd) (lseek(fd,0,SEEK_CUR))\r
++ #define _O_BINARY (0)\r
++ #define _O_RDONLY (O_RDONLY)\r
++ #define _O_WRONLY (O_WRONLY)\r
++ #define _O_SEQUENTIAL (0)\r
++ #define _O_CREAT (O_CREAT)\r
++ #define _O_TRUNC (O_TRUNC)\r
++ #define _S_IREAD (S_IRUSR|S_IRGRP|S_IROTH)\r
++ #define _S_IWRITE (S_IWUSR|S_IWGRP|S_IWOTH)\r
++ #endif\r
++ \r
+ #endif /* PORTABLE_H */\r
+diff -crN 025win/td.c 025linux/td.c
+*** 025win/td.c 2012-02-13 02:15:19.000000000 +0900
+--- 025linux/td.c 2012-02-19 14:12:30.583733648 +0900
+***************
+*** 2,14 ****
+ #include <stdio.h>\r
+ #include <string.h>\r
+ \r
+- #include <io.h>\r
+ #include <fcntl.h>\r
+ #include <sys/stat.h>\r
+ #include <sys/types.h>\r
+ \r
+! #include <windows.h>\r
+! #include <crtdbg.h>\r
+ \r
+ #include "arib_std_b25.h"\r
+ #include "b_cas_card.h"\r
+--- 2,28 ----
+ #include <stdio.h>\r
+ #include <string.h>\r
+ \r
+ #include <fcntl.h>\r
+ #include <sys/stat.h>\r
+ #include <sys/types.h>\r
+ \r
+! #if defined(WIN32)\r
+! #include <io.h>\r
+! #include <windows.h>\r
+! #include <crtdbg.h>\r
+! #else\r
+! #define __STDC_FORMAT_MACROS\r
+! #include <inttypes.h>\r
+! #include <unistd.h>\r
+! #include <time.h>\r
+! unsigned long GetTickCount(void) \r
+! {\r
+! struct timespec now;\r
+! if (clock_gettime(CLOCK_MONOTONIC, &now))\r
+! return 0;\r
+! return now.tv_sec * 1000.0 + now.tv_nsec / 1000000.0;\r
+! }\r
+! #endif\r
+ \r
+ #include "arib_std_b25.h"\r
+ #include "b_cas_card.h"\r
+***************
+*** 31,36 ****
+--- 45,51 ----
+ int n;\r
+ OPTION opt;\r
+ \r
++ #if defined(WIN32)\r
+ _CrtSetReportMode( _CRT_WARN, _CRTDBG_MODE_FILE );\r
+ _CrtSetReportFile( _CRT_WARN, _CRTDBG_FILE_STDOUT );\r
+ _CrtSetReportMode( _CRT_ERROR, _CRTDBG_MODE_FILE );\r
+***************
+*** 38,43 ****
+--- 53,59 ----
+ _CrtSetReportMode( _CRT_ASSERT, _CRTDBG_MODE_FILE );\r
+ _CrtSetReportFile( _CRT_ASSERT, _CRTDBG_FILE_STDOUT );\r
+ _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF|_CRTDBG_DELAY_FREE_MEM_DF|_CRTDBG_CHECK_ALWAYS_DF|_CRTDBG_LEAK_CHECK_DF);\r
++ #endif\r
+ \r
+ n = parse_arg(&opt, argc, argv);\r
+ if(n+2 > argc){\r
+***************
+*** 49,55 ****
+--- 65,73 ----
+ test_arib_std_b25(argv[n+0], argv[n+1], &opt);\r
+ }\r
+ \r
++ #if defined(WIN32)\r
+ _CrtDumpMemoryLeaks();\r
++ #endif\r
+ \r
+ return EXIT_SUCCESS;\r
+ }\r
+***************
+*** 311,318 ****
+--- 329,341 ----
+ fprintf(stderr, " channel: %d\n", pgrm.program_number);\r
+ fprintf(stderr, " unpurchased ECM count: %d\n", pgrm.ecm_unpurchased_count);\r
+ fprintf(stderr, " last ECM error code: %04x\n", pgrm.last_ecm_error_code);\r
++ #if defined(WIN32)\r
+ fprintf(stderr, " undecrypted TS packet: %d\n", pgrm.undecrypted_packet_count);\r
+ fprintf(stderr, " total TS packet: %d\n", pgrm.total_packet_count);\r
++ #else\r
++ fprintf(stderr, " undecrypted TS packet: %"PRId64"\n", pgrm.undecrypted_packet_count);\r
++ fprintf(stderr, " total TS packet: %"PRId64"\n", pgrm.total_packet_count);\r
++ #endif\r
+ }\r
+ }\r
+ \r