It is currently Thu Dec 12, 2019 2:58 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 105 posts ]  Go to page Previous  1 ... 3, 4, 5, 6, 7  Next
Author Message
 Post subject: Re: Services, Stuff, and Shellhook
PostPosted: Mon Feb 13, 2017 4:29 am 
Offline
Addict
Addict
User avatar

Joined: Sat Oct 09, 2010 3:47 am
Posts: 1595
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:
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

_________________

I will be unreachable from the forum for an indefinite period; downloads moved to My PureBasic Stuff.
_________________


Top
 Profile  
Reply with quote  
 Post subject: Re: Services, Stuff, and Shellhook
PostPosted: Tue Feb 14, 2017 10:23 am 
Offline
New User
New User

Joined: Tue Feb 14, 2017 10:18 am
Posts: 2
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 ?


Top
 Profile  
Reply with quote  
 Post subject: Re: Services, Stuff, and Shellhook
PostPosted: Thu Feb 16, 2017 12:49 am 
Offline
Addict
Addict
User avatar

Joined: Sat Oct 09, 2010 3:47 am
Posts: 1595
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:
#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

_________________

I will be unreachable from the forum for an indefinite period; downloads moved to My PureBasic Stuff.
_________________


Top
 Profile  
Reply with quote  
 Post subject: Re: Services, Stuff, and Shellhook
PostPosted: Thu Feb 16, 2017 7:42 am 
Offline
New User
New User

Joined: Tue Feb 14, 2017 10:18 am
Posts: 2
Thanks


Top
 Profile  
Reply with quote  
 Post subject: Re: Services, Stuff, and Shellhook
PostPosted: Thu Feb 16, 2017 8:14 am 
Offline
Addict
Addict
User avatar

Joined: Sat Feb 13, 2010 3:45 pm
Posts: 941
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 :mrgreen:


@JHPJHP
Please don't be so dewy-eyed

_________________
sorry for my bad english


Top
 Profile  
Reply with quote  
 Post subject: Re: Services, Stuff, and Shellhook
PostPosted: Thu Feb 16, 2017 3:29 pm 
Offline
Addict
Addict
User avatar

Joined: Sat Oct 09, 2010 3:47 am
Posts: 1595
Removed.

_________________

I will be unreachable from the forum for an indefinite period; downloads moved to My PureBasic Stuff.
_________________


Last edited by JHPJHP on Sun Sep 17, 2017 10:54 pm, edited 6 times in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: Services, Stuff, and Shellhook
PostPosted: Thu Feb 16, 2017 3:53 pm 
Offline
Addict
Addict
User avatar

Joined: Tue Mar 21, 2006 12:31 am
Posts: 1773
Location: Canada
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. :wink:

_________________
ʽʽSuccess is almost totally dependent upon drive and persistence. The extra energy required to make another effort or try another approach is the secret of winning.ʾʾ --Dennis Waitley


Top
 Profile  
Reply with quote  
 Post subject: Re: Services, Stuff, and Shellhook
PostPosted: Sat Feb 25, 2017 10:59 pm 
Offline
Addict
Addict
User avatar

Joined: Sat Oct 09, 2010 3:47 am
Posts: 1595
Hi Thunder93,

Thank you again for your kind words, they were very much appreciated.

----------------------------------------------

AnimateGIF.zip removed.
- moved to its own thread: GIF Toolkit

_________________

I will be unreachable from the forum for an indefinite period; downloads moved to My PureBasic Stuff.
_________________


Top
 Profile  
Reply with quote  
 Post subject: Re: Services, Stuff, and Shellhook
PostPosted: Sat Feb 25, 2017 11:14 pm 
Offline
Addict
Addict
User avatar

Joined: Tue Mar 21, 2006 12:31 am
Posts: 1773
Location: Canada
Any-time bro. :)

_________________
ʽʽSuccess is almost totally dependent upon drive and persistence. The extra energy required to make another effort or try another approach is the secret of winning.ʾʾ --Dennis Waitley


Top
 Profile  
Reply with quote  
 Post subject: Re: Services, Stuff, and Shellhook
PostPosted: Mon Feb 27, 2017 11:23 am 
Offline
User
User

Joined: Fri Feb 05, 2016 10:11 am
Posts: 73
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:
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


Top
 Profile  
Reply with quote  
 Post subject: Re: Services, Stuff, and Shellhook
PostPosted: Wed Mar 08, 2017 8:44 am 
Offline
User
User

Joined: Fri Feb 05, 2016 10:11 am
Posts: 73
In fact, why not to use simple command-line cmd?
It take a few seconds to delete, much faster than the powershell command.
Code:
vssadmin delete shadows /all


Top
 Profile  
Reply with quote  
 Post subject: Re: Services, Stuff, and Shellhook
PostPosted: Tue Apr 25, 2017 2:59 am 
Offline
User
User

Joined: Tue Oct 30, 2012 1:39 am
Posts: 81
download link said "expired or no longer there"


Top
 Profile  
Reply with quote  
 Post subject: Re: Services, Stuff, and Shellhook
PostPosted: Tue Apr 25, 2017 2:11 pm 
Offline
Addict
Addict
User avatar

Joined: Sat Oct 09, 2010 3:47 am
Posts: 1595
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.

_________________

I will be unreachable from the forum for an indefinite period; downloads moved to My PureBasic Stuff.
_________________


Top
 Profile  
Reply with quote  
 Post subject: Re: Services, Stuff, and Shellhook
PostPosted: Fri May 05, 2017 2:15 am 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Wed Sep 22, 2010 1:50 am
Posts: 796
Location: Bradenton, FL
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:
#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


Top
 Profile  
Reply with quote  
 Post subject: Re: Services, Stuff, and Shellhook
PostPosted: Fri May 05, 2017 3:16 am 
Offline
Addict
Addict
User avatar

Joined: Sat Oct 09, 2010 3:47 am
Posts: 1595
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.

_________________

I will be unreachable from the forum for an indefinite period; downloads moved to My PureBasic Stuff.
_________________


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 105 posts ]  Go to page Previous  1 ... 3, 4, 5, 6, 7  Next

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 10 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye