When building Win32-Symlink-0.04 with Perl 5.8.4 using VC6, I got the
following error on the make step:
cl -c -nologo -Gf -W3 -MD -Zi -DNDEBUG -O1 -DWIN32 -D_CONSOLE
-DNO_STRICT -DHAVE_DES_FCRYPT -DNO_HASH_SEED -DPERL_IMPLICIT_CONTEXT
-DPERL_IMPLICIT_SYS -DUSE_PERLIO -DPERL_MSVCRT_READFIX -MD -Zi -DNDEBUG
-O1 -DVERSION=\"0.04\" -DXS_VERSION=\"0.04\"
"-IK:\Tools\perl58\lib\CORE" Symlink.c
Symlink.c
tclreadlink.c(109) : error C2371: 'REPARSE_DATA_BUFFER' : redefinition;
different basic types
C:\Program Files (x86)\Microsoft Visual
Studio\VC98\INCLUDE\winnt.h(4780) : see declaration of 'REPARSE_DATA_BUFFER'
tclreadlink.c(166) : error C2039: 'ReparseTargetLength' : is not a
member of '_REPARSE_DATA_BUFFER'
C:\Program Files (x86)\Microsoft Visual
Studio\VC98\INCLUDE\winnt.h(4757) : see declaration of
'_REPARSE_DATA_BUFFER'
tclreadlink.c(174) : error C2039: 'ReparseTarget' : is not a member of
'_REPARSE_DATA_BUFFER'
C:\Program Files (x86)\Microsoft Visual
Studio\VC98\INCLUDE\winnt.h(4757) : see declaration of
'_REPARSE_DATA_BUFFER'
tclreadlink.c(174) : warning C4047: 'function' : 'const unsigned short
*' differs in levels of indirection from 'const int '
tclreadlink.c(174) : warning C4024: 'WideCharToMultiByte' : different
types for formal and actual parameter 3
tclreadlink.c(174) : warning C4047: 'function' : 'int ' differs in
levels of indirection from 'char *'
tclreadlink.c(174) : warning C4024: 'WideCharToMultiByte' : different
types for formal and actual parameter 4
tclreadlink.c(174) : warning C4047: 'function' : 'char *' differs in
levels of indirection from 'unsigned int '
tclreadlink.c(174) : warning C4024: 'WideCharToMultiByte' : different
types for formal and actual parameter 5
tclreadlink.c(174) : error C2198: 'WideCharToMultiByte' : too few actual
parameters
NMAKE : fatal error U1077: 'C:\WINDOWS\system32\cmd.exe' : return code '0x2'
Stop.
It seems that struct REPARSE_DATA_BUFFER in tclreadlink.c is
inconsistent with the struct defined in the Microsoft headers.
I was able to get a clean build simply by changing all occurrences of
REPARSE_DATA_BUFFER to MY_REPARSE_DATA_BUFFER in tclreadlink.c as shown
below:
--- orig-tclreadlink.c 2004-10-10 22:08:55.000000000 +1100
+++ tclreadlink.c 2011-10-24 12:20:16.000000000 +1100
@@ -106,12 +106,12 @@
WORD ReparseTargetMaximumLength;
WORD Dummy1;
WCHAR ReparseTarget[MAX_PATH*3];
-} REPARSE_DATA_BUFFER;
+} MY_REPARSE_DATA_BUFFER;
static int
NativeReadReparse(LinkDirectory, buffer)
CONST TCHAR* LinkDirectory; /* The junction to read */
- REPARSE_DATA_BUFFER* buffer; /* Pointer to buffer. Cannot be NULL */
+ MY_REPARSE_DATA_BUFFER* buffer; /* Pointer to buffer. Cannot be
NULL */
{
HANDLE hFile;
int returnedLength;
@@ -127,7 +127,7 @@
/* Get the link */
if (!DeviceIoControl(hFile, FSCTL_GET_REPARSE_POINT, NULL,
0, buffer,
- sizeof(REPARSE_DATA_BUFFER), &returnedLength, NULL)) {
+ sizeof(MY_REPARSE_DATA_BUFFER), &returnedLength, NULL)) {
/* Error setting junction */
/* TclWinConvertError(GetLastError()); */
CloseHandle(hFile);
@@ -147,7 +147,7 @@
CONST TCHAR* LinkDirectory;
{
int attr;
- REPARSE_DATA_BUFFER reparseBuffer;
+ MY_REPARSE_DATA_BUFFER reparseBuffer;
attr = GetFileAttributes(LinkDirectory);
if (!(attr & FILE_ATTRIBUTE_REPARSE_POINT)) {
After doing that, the module built fine, all tests passed and the module
seems to be working fine.