Page 6 of 14
Re: Services, Stuff, and Shellhook
Posted: Mon Feb 13, 2017 4:29 am
by JHPJHP
Hi coder14,
Deprecation plan for v3 printer drivers
coder14 wrote:For compatibility with older Windows I'm sticking with V3 drivers.
See the following:
JHPJHP wrote:Version 3 drivers are not guaranteed to be compatible with Windows 7, 8, 10.
Use both solutions: OSVersion()
- install the printer manually in Windows XP... create a Version 3 driver package from the installed files
- install the printer manually in Windows 10... create a Version 4 driver package from the installed files
Code: Select all
Procedure InstallPrinter()
Select OSVersion()
Case #PB_OS_Windows_XP
Case #PB_OS_Windows_Vista
Case #PB_OS_Windows_7
Case #PB_OS_Windows_8, #PB_OS_Windows_8_1
Case #PB_OS_Windows_10, #PB_OS_Windows_Future
EndSelect
EndProcedure
InstallPrinter()
If you've downloaded the full package then you have the solution:
coder14 wrote:I tried restarting the spooler and that works too (but not on XP). Is there a way to do this through code (net start/stop spooler)?
See the
Services part of
Services, Stuff, and Shellhook:
-
StartStopService.pb: start / stop the Windows Spooler service
-
WindowsServices.pbi: include file for the various Service Procedures
Re: Services, Stuff, and Shellhook
Posted: Tue Feb 14, 2017 10:23 am
by Legrec
I tryed the code of JHPJHP setcriticalflag, it's very good, but when i power off the computer there is a bsod, because i didn't remove the criticalflag.
Is there a possility to remove it automatically at the shutoff ?
Re: Services, Stuff, and Shellhook
Posted: Thu Feb 16, 2017 12:49 am
by JHPJHP
Updated:
- deleted 1 example
--
\Stuff\OtherStuff\SetCriticalFlag.pb
- added 1 example
--
\Stuff\CriticalFlag\CriticalFlag.pb
NB*: Applied a simple update to work in both the 32bit and 64bit Windows OS.
-----------------------------------------------------------
Hi Legrec,
Try the following:
- see the updated
CriticalFlag.pb example for a working solution
Code: Select all
#ENDSESSION_CLOSEAPP = $1
#ENDSESSION_CRITICAL = $40000000
#ENDSESSION_LOGOFF = $80000000
Procedure WindowCallback(hWnd, uMsg, wParam, lParam)
Result = #PB_ProcessPureBasicEvents
If uMsg = #WM_QUERYENDSESSION
Beep_(1000, 1000)
Select lParam
Case #ENDSESSION_CLOSEAPP
Case #ENDSESSION_CRITICAL
Case #ENDSESSION_LOGOFF
EndSelect
EndIf
ProcedureReturn Result
EndProcedure
If OpenWindow(0, 0, 0, 500, 200, "Set / Remove Critical Flag", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
SetWindowCallback(@WindowCallback())
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf : End
Re: Services, Stuff, and Shellhook
Posted: Thu Feb 16, 2017 7:42 am
by Legrec
Thanks
Re: Services, Stuff, and Shellhook
Posted: Thu Feb 16, 2017 8:14 am
by Josh
Legrec wrote:I tryed the code of JHPJHP setcriticalflag, it's very good, but when i power off the computer there is a bsod, because i didn't remove the criticalflag.
Is there a possility to remove it automatically at the shutoff ?
Hey boyoss,
nice to see you again under a new name
@JHPJHP
Please don't be so dewy-eyed
Re: Services, Stuff, and Shellhook
Posted: Thu Feb 16, 2017 3:29 pm
by JHPJHP
Removed.
Re: Services, Stuff, and Shellhook
Posted: Thu Feb 16, 2017 3:53 pm
by Thunder93
You can take the most innocent codes posts on these forums and use it in malicious ways. JHPJHP isn't the moderator of this forum, It isn't his job to worry about who's who. JHPJHP, don't let one rotten apple spoil your enjoyment of improving and sharing code. btw; Keep up the superb work bro.
Re: Services, Stuff, and Shellhook
Posted: Sat Feb 25, 2017 10:59 pm
by JHPJHP
Hi Thunder93,
Thank you again for your kind words, they were very much appreciated.
----------------------------------------------
AnimateGIF.zip removed.
- moved to its own thread: GIF Toolkit
Re: Services, Stuff, and Shellhook
Posted: Sat Feb 25, 2017 11:14 pm
by Thunder93
Any-time bro.
Re: Services, Stuff, and Shellhook
Posted: Mon Feb 27, 2017 11:23 am
by boyoss
Hi
Regarding the RestorePoints, there was an error in the DeleteRestorePoints procedure, here is the correction.
(It was searching for a line with a few keywords, but when there was a restorepoint with a long name, the powershell was cutting the output, and only the three first letters was showed, so i'm searching only for the "BEG" to find the appropriate line.
There was also another problem, that it didn't find alwatys the sequence number of the restore point, i fix it also)
Thank you very much for your code!
Code: Select all
Procedure DeleteRestorePoints(RestorePoints.s)
Define.s dwEventType, PS_SequenceList, PS_Sequence
If FindString(RestorePoints, #LF$)
For rtnCount = 1 To CountString(RestorePoints, #LF$)
dwEventType = StringField(RestorePoints, rtnCount, #LF$)
nSearch0 = FindString(dwEventType, "BEG")
Select #True
Case Bool(nSearch0)
PS_Sequence = Trim(Right(Trim(Mid(dwEventType, FindString(dwEventType, "BEG") - 20, 10)), 2))
If PS_Sequence
PS_SequenceList + PS_Sequence + ","
EndIf
EndSelect
Next
If PS_SequenceList : PS_SequenceList = Left(PS_SequenceList, Len(PS_SequenceList) - 1) : EndIf
Else
PS_SequenceList = Trim(RestorePoints)
EndIf
If PS_SequenceList : _DeleteRestorePoints(PS_SequenceList) : EndIf
EndProcedure
The only hic is that it takes time to delete..
when you open "SystemPropertiesProtection.exe" - "configure" and delete them manually it takes five seconds. i wonder if there is a possibility to delete them all together, and not one after the other, like you did
Re: Services, Stuff, and Shellhook
Posted: Wed Mar 08, 2017 8:44 am
by boyoss
In fact, why not to use simple command-line cmd?
It take a few seconds to delete, much faster than the powershell command.
Re: Services, Stuff, and Shellhook
Posted: Tue Apr 25, 2017 2:59 am
by Damion12
download link said "expired or no longer there"
Re: Services, Stuff, and Shellhook
Posted: Tue Apr 25, 2017 2:11 pm
by JHPJHP
Hi Damion12,
Thank you for the "heads-up", a new link has been posted.
A similar problem occurred when I was with Dropbox, possibly due to the link containing a few executables.
- full source code is also available to compile and replace the existing executables
NB*: If you scroll down the first post, you will notice various links to all the individual sections contained within the main download.
Re: Services, Stuff, and Shellhook
Posted: Fri May 05, 2017 2:15 am
by RichAlgeni
Could I ask you to take a look at this? Need to do a GZip implementation inside IIS, but I have something wrong. The end result GZip'd is larger than the source file!
Code: Select all
#ZLIB_VERSION = "1.2.8"
#ENABLE_GZIP = 16
#ENABLE_ZLIB_GZIP = 32
#Z_FINISH = 4
#Z_DEFAULT_COMPRESSION = -1
#Z_DEFLATED = 8
#MAX_MEM_LEVEL = 9
#Z_DEFAULT_STRATEGY = 0
#Z_NULL = 0
#OS_NTFS = 11
Structure Z_STREAM Align #PB_Structure_AlignC
*next_in.Byte
avail_in.l
total_in.l
*next_out.Byte
avail_out.l
total_out.l
*msg.Byte
*state
zalloc.l
zfree.l
opaque.l
data_type.i
adler.l
reserved.l
CompilerIf #PB_Compiler_Processor = #PB_Processor_x64
alignment.l
CompilerEndIf
EndStructure
Structure GZ_HEADER Align #PB_Structure_AlignC
text.i
time.l
xflags.i
os.i
*extra.Byte
extra_len.l
extra_max.l
*name.Byte
name_max.l
*comment.Byte
comm_max.l
hcrc.i
done.i
EndStructure
ImportC "D:\development\PureBasic\Utilities\zlib_64.lib"
inflateInit2_(*strm, windowBits.i, Version.s, strm_size)
inflateGetHeader(*strm, *head)
inflate(*strm, flush.i)
inflateEnd(*strm)
deflateInit2_(*strm, level.i, method.i, windowBits.i, memlevel.i, strategy.i, Version.s, strm_size)
deflateBound(*strm, sourceLen)
deflateSetHeader(*strm, *head)
deflate(*strm, flush.i)
deflateEnd(*strm)
EndImport
Procedure.s InflatePayload(*Payload, windowBits.i, GetHeader.b = #False)
LengthToRead = MemorySize(*Payload)
LengthToWrite = LengthToRead * 8
*Output = AllocateMemory(LengthToWrite)
strm.Z_STREAM
strm\next_in = *Payload
strm\avail_in = LengthToRead
strm\next_out = *Output
strm\avail_out = LengthToWrite
strm\zalloc = #Z_NULL
strm\zfree = #Z_NULL
strm\opaque = #Z_NULL
inflateInit2_(@strm, windowBits, #ZLIB_VERSION, SizeOf(Z_STREAM))
If GetHeader
head.GZ_HEADER
inflateGetHeader(@strm, @head)
EndIf
inflate(@strm, #Z_FINISH)
inflateEnd(@strm)
sOutput.s = PeekS(*Output, -1, #PB_UTF8)
FreeMemory(*Output)
ProcedureReturn sOutput
EndProcedure
Procedure DeflatePayload(sInput.s, windowBits.i, AddHeader.b = #False)
LengthToRead = StringByteLength(sInput)
strm.Z_STREAM
strm\next_in = @sInput
strm\avail_in = LengthToRead
strm\zalloc = #Z_NULL
strm\zfree = #Z_NULL
strm\opaque = #Z_NULL
deflateInit2_(@strm, #Z_DEFAULT_COMPRESSION, #Z_DEFLATED, windowBits, #MAX_MEM_LEVEL, #Z_DEFAULT_STRATEGY, #ZLIB_VERSION, SizeOf(Z_STREAM))
LengthToWrite = deflateBound(@strm, LengthToRead)
*Payload = AllocateMemory(LengthToWrite)
strm\next_out = *Payload
strm\avail_out = LengthToWrite
If AddHeader
sysTime.SYSTEMTIME
head.GZ_HEADER
head\text = #True
head\time = GetSystemTime_(sysTime)
head\os = #OS_NTFS
head\extra = #Z_NULL
head\name = #Z_NULL
head\comment = #Z_NULL
head\hcrc = #False
deflateSetHeader(@strm, @head)
EndIf
deflate(@strm, #Z_FINISH)
deflateEnd(@strm)
ProcedureReturn *Payload
EndProcedure
sOutput.s = LSet("x", 1000, "x")
*Payload = AllocateMemory(Len(sOutput) * 2)
*Payload = DeflatePayload(sOutput, 15)
MessageRequester("Test", Str(MemorySize(*Payload)))
FreeMemory(*Payload)
I appreciate your help, and your code!
Rich
Re: Services, Stuff, and Shellhook
Posted: Fri May 05, 2017 3:16 am
by JHPJHP
Hi RichAlgeni,
Awhile back I did a complete rewrite of my original script; please try the updated code. It can be download directly from the first post using the InflateDeflate link.
NB*: Many of my scripts in the Services, Stuff, and Shellhook package have had updates, but I neglected to post any information about it.