When I tried to build Win32::SecretFile I got the following errors:

C:\perl64\packages\p5-Win32-SecretFile-master>nmake Microsoft (R) Program Maintenance Utility Version 9.00.21022.08 Copyright (C) Microsoft Corporation. All rights reserved. C:\Perl64\bin\perl.exe C:\perl64\site\lib\ExtUtils\xsubpp -ty +pemap C:\Perl64\lib\ExtUtils\typemap SecretFile.xs > SecretFile.xsc +&& C:\Perl64\bin\perl.exe -MExtUtils::Command -e mv -- SecretFile.xsc + SecretFile.c Please specify prototyping behavior for SecretFile.xs (see perlxs manu +al) cl -c -I. -nologo -GF -W3 -MD -Zi -Ox -GL -fp:precise -DWIN3 +2 -D_CONSOLE -DNO_STRICT -DHAVE_DES_FCRYPT -DWIN64 -DUSE_SITECUSTOMIZ +E -DPRIVLIB_LAST_IN_INC -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS - +DUSE_PERLIO -DPERL_MSVCRT_READFIX -MD -Zi -Ox -GL -fp:precise -DVE +RSION=\"0.01\" -DXS_VERSION=\"0.01\" "-IC:\Perl64\lib\CORE" Secre +tFile.c SecretFile.c SecretFile.xs(55) : warning C4267: 'function' : conversion from 'size_ +t' to 'int', possible loss of data SecretFile.xs(58) : warning C4267: 'function' : conversion from 'size_ +t' to 'int', possible loss of data SecretFile.xs(58) : warning C4267: 'function' : conversion from 'size_ +t' to 'int', possible loss of data SecretFile.xs(82) : warning C4013: 'ConvertSidToStringSid' undefined; +assuming extern returning int SecretFile.xs(87) : warning C4013: 'ConvertStringSecurityDescriptorToS +ecurityDescriptor' undefined; assuming extern returning int SecretFile.xs(99) : warning C4267: 'function' : conversion from 'size_ +t' to 'DWORD', possible loss of data link -out:blib\arch\auto\Win32\SecretFile\SecretFile.dll -dll +-nologo -nodefaultlib -debug -opt:ref,icf -ltcg -libpath:"C:\Perl64\ +lib\CORE" -machine:AMD64 SecretFile.obj C:\Perl64\lib\CORE\perl510 +.lib oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib com +dlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib netapi32.l +ib uuid.lib ws2_32.lib mpr.lib winmm.lib version.lib odbc32.lib odbc +cp32.lib comctl32.lib bufferoverflowU.lib msvcrt.lib -def:SecretFile. +def Creating library blib\arch\auto\Win32\SecretFile\SecretFile.lib and + object blib\arch\auto\Win32\SecretFile\SecretFile.exp SecretFile.obj : error LNK2001: unresolved external symbol ConvertStri +ngSecurityDescriptorToSecurityDescriptor SecretFile.obj : error LNK2001: unresolved external symbol ConvertSidT +oStringSid blib\arch\auto\Win32\SecretFile\SecretFile.dll : fatal error LNK1120: +2 unresolved externals NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual S +tudio 9.0\VC\Bin\amd64\link.EXE"' : return code '0x460' Stop.

Which confuses me because in the exact same environment and using the same includes I build my code without errors:

C:\test>cl /W3 Permissions.c Advapi32.lib Microsoft (R) C/C++ Optimizing Compiler Version 15.00.21022.08 for x64 Copyright (C) Microsoft Corporation. All rights reserved. Permissions.c Microsoft (R) Incremental Linker Version 9.00.21022.08 Copyright (C) Microsoft Corporation. All rights reserved. /out:Permissions.exe Permissions.obj Advapi32.lib

I have a work around that fixes the unresolved externals (but not the 'ConvertSidToStringSid' undefined; assuming extern returning int?); and that is to explicitly use the A versions of the two functions:

if (ConvertSidToStringSidA(sid, &sid_as_string)) { PSECURITY_DESCRIPTOR sd = NULL; DWORD sd_size; SV *ssd_as_sv = sv_2mortal(newSVpvf(ssd_template, sid_ +as_string, sid_as_string)); LocalFree(sid_as_string); if (ConvertStringSecurityDescriptorToSecurityDescripto +rA(SvPV_nolen(ssd_as_sv), + SDDL_REVISION_1, + &sd, &sd_size)) {

The the build completes:

C:\test>pushd \perl64\packages\p5-Win32-SecretFile-master C:\perl64\packages\p5-Win32-SecretFile-master>nmake install Microsoft (R) Program Maintenance Utility Version 9.00.21022.08 Copyright (C) Microsoft Corporation. All rights reserved. C:\Perl64\bin\perl.exe C:\perl64\site\lib\ExtUtils\xsubpp -ty +pemap C:\Perl64\lib\ExtUtils\typemap SecretFile.xs > SecretFile.xsc +&& C:\Perl64\bin\perl.exe -MExtUtils::Command -e mv -- SecretFile.xsc + SecretFile.c Please specify prototyping behavior for SecretFile.xs (see perlxs manu +al) cl -c -I. -nologo -GF -W3 -MD -Zi -Ox -GL -fp:precise -DWIN3 +2 -D_CONSOLE -DNO_STRICT -DHAVE_DES_FCRYPT -DWIN64 -DUSE_SITECUSTOMIZ +E -DPRIVLIB_LAST_IN_INC -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS - +DUSE_PERLIO -DPERL_MSVCRT_READFIX -MD -Zi -Ox -GL -fp:precise -DVE +RSION=\"0.01\" -DXS_VERSION=\"0.01\" "-IC:\Perl64\lib\CORE" Secre +tFile.c SecretFile.c SecretFile.xs(55) : warning C4267: 'function' : conversion from 'size_ +t' to 'int', possible loss of data SecretFile.xs(58) : warning C4267: 'function' : conversion from 'size_ +t' to 'int', possible loss of data SecretFile.xs(58) : warning C4267: 'function' : conversion from 'size_ +t' to 'int', possible loss of data SecretFile.xs(82) : warning C4013: 'ConvertSidToStringSidA' undefined; + assuming extern returning int SecretFile.xs(87) : warning C4013: 'ConvertStringSecurityDescriptorToS +ecurityDescriptorA' undefined; assuming extern returning int SecretFile.xs(99) : warning C4267: 'function' : conversion from 'size_ +t' to 'DWORD', possible loss of data link -out:blib\arch\auto\Win32\SecretFile\SecretFile.dll -dll +-nologo -nodefaultlib -debug -opt:ref,icf -ltcg -libpath:"C:\Perl64\ +lib\CORE" -machine:AMD64 SecretFile.obj C:\Perl64\lib\CORE\perl510 +.lib oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib com +dlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib netapi32.l +ib uuid.lib ws2_32.lib mpr.lib winmm.lib version.lib odbc32.lib odbc +cp32.lib comctl32.lib bufferoverflowU.lib msvcrt.lib -def:SecretFile. +def Creating library blib\arch\auto\Win32\SecretFile\SecretFile.lib and + object blib\arch\auto\Win32\SecretFile\SecretFile.exp Generating code Finished generating code if exist blib\arch\auto\Win32\SecretFile\SecretFile.dll.manife +st mt -nologo -manifest blib\arch\auto\Win32\SecretFile\SecretFile.dl +l.manifest -outputresource:blib\arch\auto\Win32\SecretFile\SecretFile +.dll;2 if exist blib\arch\auto\Win32\SecretFile\SecretFile.dll.manife +st del blib\arch\auto\Win32\SecretFile\SecretFile.dll.manifest C:\Perl64\bin\perl.exe -MExtUtils::Command -e chmod -- 755 bli +b\arch\auto\Win32\SecretFile\SecretFile.dll Files found in blib\arch: installing files in blib\lib into architectu +re dependent library tree Installing C:\Perl64\site\lib\auto\Win32\SecretFile\SecretFile.dll Installing C:\Perl64\site\lib\auto\Win32\SecretFile\SecretFile.exp Installing C:\Perl64\site\lib\auto\Win32\SecretFile\SecretFile.lib Installing C:\Perl64\site\lib\auto\Win32\SecretFile\SecretFile.pdb Appending installation info to C:\Perl64\lib/perllocal.pod C:\perl64\packages\p5-Win32-SecretFile-master>

And the code the runs:

C:\perl64\packages\p5-Win32-SecretFile-master>popd C:\test>perl -MWin32::SecretFile -E"say Win32::SecretFile::_create_sec +ret_file( 'mysecretfile.txt', 'Now is the time for all good men.', 0 +);" 1 C:\test>type mysecretfile.txt Now is the time for all good men. C:\test>

With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

In reply to Re^9: Private temporal files on Windows by BrowserUk
in thread Private temporal files on Windows by salva

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.