PowerBasic Forum
#11
This is the newer version of Stuart's PipeToString function provided in an SLL.

It uses the new AllocConsoleWithOptions that is available since Windows 11 24H2 build 26100. 

This version allows you to use the pipetostring function without without showing the console itself. There are tons of interesting applications for this. Warning: only WINDOWS 11 24H2


Code:
'========================================================================================================
'PipeToString SLL for PBWin
'=========================================================================================================
#COMPILE SLL "PipeToString-PBWin.sll"
#DIM ALL
#INCLUDE "win32api.inc"
DECLARE FUNCTION popen CDECL LIB "msvcrt.dll" ALIAS "_popen" (BYREF cmd AS STRINGZ, BYREF MODE AS STRINGZ) AS DWORD
DECLARE FUNCTION fread CDECL LIB "msvcrt.dll" ALIAS "fread" (BYVAL buffer AS DWORD, BYVAL elemSize AS DWORD, BYVAL elemCount AS DWORD, BYVAL fp AS DWORD) AS DWORD
DECLARE FUNCTION fclose CDECL LIB "msvcrt.dll" ALIAS "fclose" (BYVAL fp AS DWORD) AS LONG

type ALLOC_CONSOLE_OPTIONS
    mode          as long
    nUseShowWindow as long
    wShowWindow    as word
end type

Declare function AllocConsoleWithOptions Import "Kernel32.dll" alias "AllocConsoleWithOptions" _
  (opt ByVal tOptions as ALLOC_CONSOLE_OPTIONS Ptr, Opt Byref nResult as long) as long

enum ALLOC_CONSOLE_RESULT
  ALLOC_CONSOLE_RESULT_NO_CONSOLE      = 0
  ALLOC_CONSOLE_RESULT_NEW_CONSOLE      = 1
  ALLOC_CONSOLE_RESULT_EXISTING_CONSOLE = 2
end enum

enum ALLOC_CONSOLE_MODE
  ALLOC_CONSOLE_MODE_DEFAULT    = 0
  ALLOC_CONSOLE_MODE_NEW_WINDOW = 1
  ALLOC_CONSOLE_MODE_NO_WINDOW  = 2
end enum


FUNCTION PipeToString(cmdIn AS STRING) COMMON AS WSTRING
    LOCAL sbOut AS ISTRINGBUILDERA
    LOCAL szBuf AS STRINGZ * 1048
    LOCAL szCmdIn AS STRINGZ * 256
    LOCAL hP,dwBytesRead  AS DWORD

    local tConsole as ALLOC_CONSOLE_OPTIONS
    local nResult  as long
    local hR        as long

    tConsole.mode = %ALLOC_CONSOLE_MODE.ALLOC_CONSOLE_MODE_NO_WINDOW

    szCmdIn = cmdIn
    hR = AllocConsoleWithOptions(VarPtr(tConsole), nResult)
    if HR <> 0 then exit function
    hP = popen(szCmdIn, "rb")
    IF hP = 0 THEN EXIT FUNCTION
    sbOut = CLASS "StringBuilderA"
    DO
      dwBytesRead = fread(VARPTR(szBuf), 1, SIZEOF(szBuf), hP)
      sbOut.Add(LEFT$(szBuf, dwBytesRead))
    LOOP WHILE dwBytesRead
    fclose(hP)
    Freeconsole
    FUNCTION = OEMTOCHR$(sbOut.string)
END FUNCTION
'
Reply
#12
(08-29-2025, 09:04 PM)Steven Pringels Wrote: This is the newer version of Stuart's PipeToString function provided in an SLL.

It uses the new AllocConsoleWithOptions that is available since Windows 11 24H2 build 26100. 

This version allows you to use the pipetostring function without without showing the console itself. There are tons of interesting applications for this. Warning: only WINDOWS 11 24H2

Neat! Thank you.
Reply
#13
Howdy, Eric!

Yes, about the same time, I think. Adam sent me a note and he's thinking it's a payment issue again.

But now that they have moved him into other responsibilities, he has lost the ability to log in to the forum to make a payment or even to confirm that is the issue.

My attempts to contact the company management have met with no success.
Reply
#14
(08-30-2025, 04:36 AM)Gary Beene Wrote: Howdy, Eric!

Yes, about the same time, I think.  Adam sent me a note and he's thinking it's a payment issue again.

But now that they have moved him into other responsibilities, he has lost the ability to log in to the forum to make a payment or even to confirm that is the issue.

My attempts to contact the company management have met with no success.

I doubt that it is a forum issue.  The powerbasic.com DNS A record still exists but the subdomain forum.powerbasic.com does not have a DNS record.  That means that someone physically edited the DNS records for the primary  domain.

(Possibly a change of DNS server and they did not create the forum entry when they created the records on the new server?)
Reply
#15
" The powerbasic.com DNS A record still exists but the subdomain forum.powerbasic.com does not have a DNS record.  That means that someone physically edited the DNS records for the primary  domain. ..."

Agree. I checked domain expire date a couple days ago, but physical edit of only the forum didn't occur to me. Just checked www.powerbasic.com and same the "under maintenance" page still shows.
Reply
#16
(08-30-2025, 05:56 AM)Dale Yarker Wrote:  Just checked www.powerbasic.com and same the "under maintenance" page still shows.

Interestingly, it's geo-fenced.

I can't access it from PNG nor from a VPN routed through Japan or Netherlands.  Routing the VPN through a US server does get through to the "under maintenance" page.
Reply
#17
Maybe a different A record on some DNS cache has longer TTL from here?
Reply
#18
Powerbasic.com TTL is 30min
https://dnschecker.org/all-dns-records-o...dns=google

it appears to be fully propagated
https://dnschecker.org/#A/powerbasic.com

Forum.powerbasic.com nowhere to be found  Sad
Reply
#19
(08-30-2025, 08:12 AM)Dale Yarker Wrote: Maybe a different A record on some DNS cache has longer TTL from here?

No, geo-fencing.  Blocking IP addresses by geographical location:

Access denied

Error 16
www.powerbasic.com
2025-08-30 07:50:27 UTC
What happened?
This request was blocked by our security service
Your IP: 124.240.212.185
Proxy IP: 45.223.21.158 (ID 10343-100)
Incident ID: 343000420552083521-666214062594919050 

Powered by Imperva


Imperva is a web firewall service.
Reply
#20
" No, geo-fencing.  Blocking IP addresses by geographical location:" Seems a lot of effort to block "under maintenance".

Rolleyes
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)