Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

What we anticipate seldom occurs; what we least expect generally happens. -- Bengamin Disraeli


devel / comp.lang.clipper.visual-objects / Re: SHGetKnownFolderPath

SubjectAuthor
* SHGetKnownFolderPathStefan Ungemach
+- SHGetKnownFolderPathStefan Ungemach
`* SHGetKnownFolderPathJamal
 `- SHGetKnownFolderPathStefan Ungemach

1
SHGetKnownFolderPath

<c211f145-f262-4708-b481-694cef4a4fb1n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=10069&group=comp.lang.clipper.visual-objects#10069

  copy link   Newsgroups: comp.lang.clipper.visual-objects
X-Received: by 2002:a05:620a:240c:b0:76d:7a5f:5f04 with SMTP id d12-20020a05620a240c00b0076d7a5f5f04mr223305qkn.1.1692890021165;
Thu, 24 Aug 2023 08:13:41 -0700 (PDT)
X-Received: by 2002:a05:6a00:181c:b0:68a:6cf0:93fc with SMTP id
y28-20020a056a00181c00b0068a6cf093fcmr3416677pfa.0.1692890020560; Thu, 24 Aug
2023 08:13:40 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.clipper.visual-objects
Date: Thu, 24 Aug 2023 08:13:40 -0700 (PDT)
Injection-Info: google-groups.googlegroups.com; posting-host=93.234.124.75; posting-account=i-F9aAoAAAA0pvxb5etomv0475oTwJyh
NNTP-Posting-Host: 93.234.124.75
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <c211f145-f262-4708-b481-694cef4a4fb1n@googlegroups.com>
Subject: SHGetKnownFolderPath
From: stefan.u...@bingo-ev.de (Stefan Ungemach)
Injection-Date: Thu, 24 Aug 2023 15:13:41 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 1659
 by: Stefan Ungemach - Thu, 24 Aug 2023 15:13 UTC

Has anyone used the SHGetKnownFolderPath API function in VO yet? I've played around with it, but never get a result. Last attempt was:

DEFINE FOLDERID_SkyDrive := "{A52BBA46-E9E1-435f-B3D9-28DAA648C0F6}"
_dll function SHGetKnownFolderPath(pszGUID as psz,dwFlags as dword,hHandle as ptr,pOut ref psz) as logic pascal:Shell32.SHGetKnownFolderPath
function getOneDriveDir() as string pascal
local cRueck as string
local pszPath as psz

pszPath := memalloc( MAX_PATH )
if SHGetKnownFolderPath( string2psz(FOLDERID_SkyDrive), 0, NULL, @pszpath )
? "success"
cRueck := psz2string( pszPath )
endif
memfree( pszPath )
return cRueck

Re: SHGetKnownFolderPath

<891c617d-9034-4b94-adec-2a63ea602b25n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=10070&group=comp.lang.clipper.visual-objects#10070

  copy link   Newsgroups: comp.lang.clipper.visual-objects
X-Received: by 2002:ad4:4baf:0:b0:64a:ef9d:cfba with SMTP id i15-20020ad44baf000000b0064aef9dcfbamr207185qvw.7.1692892209466;
Thu, 24 Aug 2023 08:50:09 -0700 (PDT)
X-Received: by 2002:a17:902:fb05:b0:1bd:e698:74e with SMTP id
le5-20020a170902fb0500b001bde698074emr2295495plb.6.1692892208951; Thu, 24 Aug
2023 08:50:08 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.clipper.visual-objects
Date: Thu, 24 Aug 2023 08:50:08 -0700 (PDT)
In-Reply-To: <c211f145-f262-4708-b481-694cef4a4fb1n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=93.234.124.75; posting-account=i-F9aAoAAAA0pvxb5etomv0475oTwJyh
NNTP-Posting-Host: 93.234.124.75
References: <c211f145-f262-4708-b481-694cef4a4fb1n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <891c617d-9034-4b94-adec-2a63ea602b25n@googlegroups.com>
Subject: Re: SHGetKnownFolderPath
From: stefan.u...@bingo-ev.de (Stefan Ungemach)
Injection-Date: Thu, 24 Aug 2023 15:50:09 +0000
Content-Type: text/plain; charset="UTF-8"
 by: Stefan Ungemach - Thu, 24 Aug 2023 15:50 UTC

Stefan Ungemach schrieb am Donnerstag, 24. August 2023 um 17:13:42 UTC+2:
> Has anyone used the SHGetKnownFolderPath API function in VO yet? I've played around with it, but never get a result. Last attempt was:
>
> DEFINE FOLDERID_SkyDrive := "{A52BBA46-E9E1-435f-B3D9-28DAA648C0F6}"
> _dll function SHGetKnownFolderPath(pszGUID as psz,dwFlags as dword,hHandle as ptr,pOut ref psz) as logic pascal:Shell32.SHGetKnownFolderPath
> function getOneDriveDir() as string pascal
> local cRueck as string
> local pszPath as psz
>
>
> pszPath := memalloc( MAX_PATH )
> if SHGetKnownFolderPath( string2psz(FOLDERID_SkyDrive), 0, NULL, @pszpath )
> ? "success"
> cRueck := psz2string( pszPath )
> endif
> memfree( pszPath )
> return cRueck

Update: This doesn't work either and even does not rech the "success" line:

_dll function SHGetKnownFolderPath(pszGUID ref _WINGUID,dwFlags as dword,hHandle as ptr,pOut ref psz) as logic pascal:Shell32.SHGetKnownFolderPath#514
function getOneDriveDir() as string pascal
local cRueck as string
local pszPath as psz
local struGUID is _WINGUID
if CreateGuidFromString(FOLDERID_SkyDrive, @struGUID)
pszPath := memalloc( MAX_PATH )
if SHGetKnownFolderPath( @struGUID, 0, NULL, @pszpath )
? "success"
cRueck := psz2string( pszPath )
? len(cRueck)
endif
memfree( pszPath )
endif
return cRueck

Re: SHGetKnownFolderPath

<ucbsua$e8ln$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=10071&group=comp.lang.clipper.visual-objects#10071

  copy link   Newsgroups: comp.lang.clipper.visual-objects
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: vodot...@gmail.com (Jamal)
Newsgroups: comp.lang.clipper.visual-objects
Subject: Re: SHGetKnownFolderPath
Date: Fri, 25 Aug 2023 23:52:41 -0400
Organization: A noiseless patient Spider
Lines: 97
Message-ID: <ucbsua$e8ln$1@dont-email.me>
References: <c211f145-f262-4708-b481-694cef4a4fb1n@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sat, 26 Aug 2023 03:52:42 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="04dcaf2fcaa78eac088dd6a7cf3440bf";
logging-data="467639"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/ofT+ebLO4qWi6OnA5saKx/Whv4bUBwxo="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.14.0
Cancel-Lock: sha1:NkGk77TdbhCgyre9IVqzfZ2IPdM=
Content-Language: en-US
In-Reply-To: <c211f145-f262-4708-b481-694cef4a4fb1n@googlegroups.com>
 by: Jamal - Sat, 26 Aug 2023 03:52 UTC

Stefan,

This was tricky to find the solution for as I never used before.
I was getting a success but only the letter C was returned. I found out
the pszPath returned as WCHAR type. VO has undocumented function to
return the correct result using W2String() which uses Win32
WideCharToMultiByte() and VO's Mem2String() to return the full path
correctly.

Here is the full working code. Let me know how it goes.

_dll function SHGetKnownFolderPath(pszGUID as _WINGUID, dwFlags as
DWORD, hHandle as ptr, pOut ref ptr) as int
pascal:Shell32.SHGetKnownFolderPath

function GetKnownFolderPath(cGuidString as string) as string pascal
local cFolderPath as string
local pszPath as psz
LOCAL pGuid as _WINGUID

pGuid := MemAlloc( _sizeof( _WINGUID ) )

CreateGuidFromString(cGuidString, pGuid)
// ? Guid2String( pGuid )
pszPath := MemAlloc( MAX_PATH )
if SHGetKnownFolderPath( pGuid, 0, null_ptr, @pszPath ) = S_OK
cFolderPath := W2String(pszPath)
endif

MemFree( pGuid )
return cFolderPath

FUNCTION Start()
local a := {} as array
local i as dword

a := {ComputerFolder,Favorites,
Documents,Pictures,Music,Videos,Downloads,Desktop,PublicDocuments,PublicPictures,PublicMusic,PublicVideos,PublicDownloads,UserProfile,Contacts,Links,PublicFolder,Programs}

for i := 1 to ALen(a)
? GetKnownFolderPath(a[i])
next
WAIT
RETURN nil

// defines
DEFINE ComputerFolder := "{0AC0837C-BBF8-452A-850D-79D08E667CA7}"
DEFINE Favorites := "{1777F761-68AD-4D8A-87BD-30B759FA33DD}"
DEFINE Documents := "{FDD39AD0-238F-46AF-ADB4-6C85480369C7}"
DEFINE Pictures := "{33E28130-4E1E-4676-835A-98395C3BC3BB}"
DEFINE Music := "{4BD8D571-6D19-48D3-BE97-422220080E43}"
DEFINE Videos := "{18989B1D-99B5-455B-841C-AB7C74E4DDFC}"
DEFINE Downloads := "{374DE290-123F-4565-9164-39C4925E467B}"
DEFINE Desktop := "{B4BFCC3A-DB2C-424C-B029-7FE99A87C641}"
DEFINE PublicDocuments := "{ED4824AF-DCE4-45A8-81E2-FC7965083634}"
DEFINE PublicPictures := "{B6EBFB86-6907-413C-9AF7-4FC2ABF07CC5}"
DEFINE PublicMusic := "{3214FAB5-9757-4298-BB61-92A9DEAA44FF}"
DEFINE PublicVideos := "{2400183A-6185-49FB-A2D8-4A392A602BA3}"
DEFINE PublicDownloads := "{3D644C9B-1FB8-4F30-9B45-F670235F79C0}"
DEFINE UserProfile := "{5E6C858F-0E22-4760-9AFE-EA3317B67173}"
DEFINE Contacts := "{56784854-C6CB-462B-8169-88E350ACB882}"
DEFINE Links := "{BFB9D5E0-C6A9-404C-B2B2-AE6DB6AF4968}"
DEFINE PublicFolder := "{DFDF76A2-C82A-4D63-906A-5644AC457385}"
DEFINE Programs := "{A77F5D77-2E2B-44C3-A6A2-ABA601054A51}"

Jamal

On 8/24/2023 11:13 AM, Stefan Ungemach wrote:
> Has anyone used the SHGetKnownFolderPath API function in VO yet? I've played around with it, but never get a result. Last attempt was:
>
> DEFINE FOLDERID_SkyDrive := "{A52BBA46-E9E1-435f-B3D9-28DAA648C0F6}"
> _dll function SHGetKnownFolderPath(pszGUID as psz,dwFlags as dword,hHandle as ptr,pOut ref psz) as logic pascal:Shell32.SHGetKnownFolderPath
> function getOneDriveDir() as string pascal
> local cRueck as string
> local pszPath as psz
>
>
> pszPath := memalloc( MAX_PATH )
> if SHGetKnownFolderPath( string2psz(FOLDERID_SkyDrive), 0, NULL, @pszpath )
> ? "success"
> cRueck := psz2string( pszPath )
> endif
> memfree( pszPath )
> return cRueck

Re: SHGetKnownFolderPath

<28000e1c-4d42-4761-a391-ef2e0eba3b97n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=10073&group=comp.lang.clipper.visual-objects#10073

  copy link   Newsgroups: comp.lang.clipper.visual-objects
X-Received: by 2002:a05:622a:18a9:b0:412:1974:9730 with SMTP id v41-20020a05622a18a900b0041219749730mr65050qtc.5.1693479160917;
Thu, 31 Aug 2023 03:52:40 -0700 (PDT)
X-Received: by 2002:a05:6a00:98d:b0:68a:58e1:ebf5 with SMTP id
u13-20020a056a00098d00b0068a58e1ebf5mr1188407pfg.2.1693479160468; Thu, 31 Aug
2023 03:52:40 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.clipper.visual-objects
Date: Thu, 31 Aug 2023 03:52:39 -0700 (PDT)
In-Reply-To: <ucbsua$e8ln$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=95.91.239.178; posting-account=i-F9aAoAAAA0pvxb5etomv0475oTwJyh
NNTP-Posting-Host: 95.91.239.178
References: <c211f145-f262-4708-b481-694cef4a4fb1n@googlegroups.com> <ucbsua$e8ln$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <28000e1c-4d42-4761-a391-ef2e0eba3b97n@googlegroups.com>
Subject: Re: SHGetKnownFolderPath
From: stefan.u...@bingo-ev.de (Stefan Ungemach)
Injection-Date: Thu, 31 Aug 2023 10:52:40 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 2223
 by: Stefan Ungemach - Thu, 31 Aug 2023 10:52 UTC

Jamal schrieb am Samstag, 26. August 2023 um 05:52:45 UTC+2:
> Stefan,
>
> This was tricky to find the solution for as I never used before.
> I was getting a success but only the letter C was returned. I found out
> the pszPath returned as WCHAR type. VO has undocumented function to
> return the correct result using W2String() which uses Win32
> WideCharToMultiByte() and VO's Mem2String() to return the full path
> correctly.
>
> Here is the full working code. Let me know how it goes.

Hi Jamal,

thanks for pointing out W2String() to me. After a slight modification (ShGetKnownFolderPath returns false for some reason the following code now works for me:

function GetKnownFolderPath(cGuidString as string) as string pascal
local cFolderPath as string
local pszPath as psz
local struGUID is _WINGUID

if CreateGuidFromString(cGuidString, @struGUID)
pszPath := MemAlloc( MAX_PATH )
SHGetKnownFolderPath( @struGUID, 0, null_ptr, @pszPath )
cFolderPath := W2String(pszPath)
memfree( pszPath )
endif
return cFolderPath

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor