Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re^8: Private temporal files on Windows

by salva (Canon)
on Dec 21, 2014 at 23:11 UTC ( [id://1110982]=note: print w/replies, xml ) Need Help??


in reply to Re^7: Private temporal files on Windows
in thread Private temporal files on Windows

I am currently trying to make a module from that: https://github.com/salva/p5-Win32-SecretFile

Replies are listed 'Best First'.
Re^9: Private temporal files on Windows
by BrowserUk (Patriarch) on Dec 22, 2014 at 01:29 UTC

    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.
      I have pushed a new version with your fixes.

      BTW, I am unable to make the latest version of ActivePerl (64bits) work together with the latest VisualStudio in order to build modules.

      Looking at perl -V it looks as if they were now compiling ActivePerl with MinGW. Is that right, or is just a trick by ActivePerl::Config?

        salva, I strongly suggest you add FILE_ATTRIBUTE_HIDDEN to the existing FILE_ATTRIBUTE_TEMPORARY on the CreateFile().

        Also, if you add:

        MODULE = Win32::SecretFile PACKAGE = Win32::SecretFile PROTOTYPES: ENABLE <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

        It fixes the warning below when building for Strawberry Perl 5.18 with mingw:

        Please specify prototyping behavior for SecretFile.xs (see perlxs manu +al)

        I haven't been able to find a fix for the warnings:

        SecretFile.xs(82) : warning C4013: 'ConvertSidToStringSidA' undefined; + assuming extern returning int SecretFile.xs(87) : warning C4013: 'ConvertStringSecurityDescriptorToS +ecurityDescriptorA' undefined; assuming extern returning int

        When building with MSVC for AS 5.10 -- it appears to be down to differences between the sddl.h files as shipped with mingw -v- that shipped with MSVC -- but as AS have gone over to mingw, those of us still using msvc to build perl stuff are probably a small and dying minority; and it doesn't prevent it from building.

        (PS. Sorry for doing this through PM rather than github, but I've barely used git and I'd hate to screw it up.)


        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.
        BTW, I am unable to make the latest version of ActivePerl (64bits) work together with the latest VisualStudio in order to build modules. Looking at perl -V it looks as if they were now compiling ActivePerl with MinGW. Is that right, or is just a trick by ActivePerl::Config?

        Indeed, that seems to be the case; though your best bet for the full skinny about it is to talk to syphilis. He has been doing the MingW thing for a long time and understands a lot more of it than I do.

        I've tried mixing msvc and the MingW built AS perl's a few times and somethings work; some don't; and I have no clear idea of what and why.

        Installing Strawberry Perl now brings MingW with it; but as I showed above; that presents a whole different set of (so far) completely unexplainable anomalies.

        Perl on Win32 continues to be a bit of a mess; things work more by luck than judgement a lot of the time :(


        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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1110982]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (6)
As of 2024-03-29 01:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found