NO

Recent Posts

Pages: 1 2 [3] 4 5 ... 10
21
Assembly discussions / Re: Trimming spaces and tabs inside a string
« Last post by frankie on June 11, 2024, 02:43:39 PM »
When just a couple of symbols are to be compared the efficiency isn't much between normal comparing vs tables lookup.
When more symbols are to be checked, i.e. word separators, a lookup table rocket speeds-up the execution  ;).
22
Assembly discussions / Re: Trimming spaces and tabs inside a string
« Last post by John Z on June 11, 2024, 01:32:04 PM »
Hi Vortex,

I'm wondering what is the advantage in using the table when there are only two cases that need to be checked.
I would think the table uses more space than coding a check for 09 and a check for 32.  Granted that two checks would need to be done every time byte was < 33 whereas with the table only one check always....

John Z
23
Chit-Chat / Visual Studio Code marketplace
« Last post by John Z on June 10, 2024, 11:36:12 AM »
"Malicious VSCode extensions with millions of installs discovered"

https://www.bleepingcomputer.com/news/security/malicious-vscode-extensions-with-millions-of-installs-discovered/

Just a heads up if you use Visual Studio Code (VSCode) when not enjoying Pelles C.

John Z
24
Assembly discussions / Trimming spaces and tabs inside a string
« Last post by Vortex on June 09, 2024, 12:03:13 PM »
Function trimming spaces and tabs inside a string :

Code: [Select]
.386
.model flat,stdcall
option casemap:none

ExitProcess PROTO :DWORD
printf PROTO C :DWORD,:VARARG

includelib  \PellesC\lib\Win\kernel32.lib
includelib  \PellesC\lib\Win\user32.lib
includelib  msvcrt.lib

.data

lookupTbl   db 1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
            db 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
            db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
            db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
            db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
            db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
            db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
            db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1


mystr       db '    This    Is   A       Test String.',0
message     db 'Trimmed string = %s',13,10
            db 'Length of the string = %u',0

.data?

buffer      db 64 dup(?)


.code

RemoveSpaces PROC uses edi ebx str1:DWORD,buff:DWORD

    mov     ebx,OFFSET lookupTbl
    mov     ecx,str1
    mov     edi,buff
@@:
    movzx   eax,BYTE PTR [ecx]
    movzx   edx,BYTE PTR [ebx+eax]
    mov     BYTE PTR [edi],al
    add     ecx,1
    add     edi,edx
    test    eax,eax
    jnz     @b   
 
finish:

    mov     eax,edi
    sub     eax,1
    sub     eax,buff
    ret

RemoveSpaces ENDP

start:

    invoke  RemoveSpaces,ADDR mystr,ADDR buffer
    invoke  printf,ADDR message,ADDR buffer,eax
    invoke  ExitProcess,0

END start
25
Beginner questions / Re: AI, Google Search, and Internet Changes
« Last post by MrBcx on June 04, 2024, 11:40:35 PM »

I think you should introduce yourself so others may be more comfortable in responding
and knowing the purpose, or use case for the replies... IMO of course....

John Z

I share John's opinion. 

With AI's rapid advancement, a healthy dose of skepticism is preventative medicine.

26
User contributions / Re: Enumerating remote printers
« Last post by Vortex on June 03, 2024, 08:17:39 PM »
Hi John,

You are welcome. Thanks for your version.
27
User contributions / Re: Enumerating remote printers > into LOCAL Printers
« Last post by John Z on June 03, 2024, 01:37:27 PM »
Command-line tool to list shared printers :

Very neat Vortex!  Thanks!!

Hopefully you won't mind I created a derivative TOTALLY based on your program, to just list Local Printers.   
Attached project zip here. 

John Z
28
User contributions / Enumerating remote printers
« Last post by Vortex on June 02, 2024, 09:05:52 PM »
Coomand-line tool to list shared printers :

Code: [Select]
#include <windows.h>

#include <winspool.h>

#include <stdio.h>

int main(int argc, char * argv[]) {

    DWORD cbBuf = 0;
    DWORD pcReturned;
    PRINTER_INFO_2 * prinfo;
    BOOL r;
    int rv = 0;
    DWORD i;

    char * err = "The EnumPrinters API could not retrieve printer information.\n";

    if (argc != 2) {
        printf("ListPrinters V1.0 by Vortex\n\nUsage : ListPrinters \\\\server\n");
        return 1;
    }

    EnumPrinters(PRINTER_ENUM_SHARED | PRINTER_ENUM_NAME, argv[1], 2, NULL, 0, & cbBuf, & pcReturned);

    if (!cbBuf) {
        printf("%s", err);
        return 2;
    }

    prinfo = (PRINTER_INFO_2 * )VirtualAlloc(0, cbBuf, MEM_COMMIT, PAGE_READWRITE);

    if (!prinfo) {
        printf("Memory allocation failed.\n");
        return 3;
    }

    r = EnumPrinters(PRINTER_ENUM_SHARED | PRINTER_ENUM_NAME, argv[1], 2, (LPBYTE) prinfo, cbBuf, & cbBuf, & pcReturned);

    if (!r) {
        printf("%s", err);
        rv = 2;

    } else {

        for (i = 0; i < pcReturned; ++i) {
            printf("%s\n", prinfo[i].pShareName);
        }
    }

    VirtualFree(prinfo, 0, MEM_RELEASE);
    return rv;

}
29
Beginner questions / Re: AI, Google Search, and Internet Changes
« Last post by John Z on June 02, 2024, 03:35:20 PM »
hello thomasmuller,

Welcome to the forum with your first post.

You mention "our programming practices and learning experiences with Pelles C", have you actually used it?

Are you a reporter or other type of writer? 

What will be done with this information?

Will responders be quoted ? 

I think you should introduce yourself so others may be more comfortable in responding and knowing the purpose, or use case for the replies... IMO of course....

John Z
 
30
Beginner questions / AI, Google Search, and Internet Changes
« Last post by thomasmuller on June 02, 2024, 10:37:44 AM »
Hi everyone,
With the advancements in AI and continuous changes to Google Search, I'm curious about how these developments are influencing our programming practices and learning experiences with Pelles C.
- AI Tools: Have you started using AI tools to assist in coding or debugging? How effective are they?
- Search Algorithm Updates: Do the recent Google Search changes make it easier or harder to find specific programming resources?
- Future Impact: How do you think these technological advancements will shape the future of learning and using Pelles C?
Looking forward to your insights!
Pages: 1 2 [3] 4 5 ... 10