Skip to content

NPPM_GETOPENFILENAMES should be deprecated (or better-documented) #15997

@molsonkiko

Description

@molsonkiko

Is there an existing issue for this?

  • I have searched the existing issues

Description of the Issue

See this community forum thread.

In short, the INotepadPPGateway.GetOpenFileNames method in JsonTools was using NPPM_GETOPENFILENAMES to get all the names of open files, and this worked fine until it suddenly randomly started crashing Notepad++ every time I sent that message. I was able to fix this by using the approach shown here..

In the forum thread linked above, AlanKilborn and Coises both agreed that this crash was probably caused by the use of lstrcpy in the NPPM_GETOPENFILENAMES callback code.

I'm not asking you to change any existing functionality. I'm just asking you to add a comment after the definition of NPPM_GETOPENFILENAMES indicating that this message can potentially cause memory errors and unexpected NPP crashes.

Steps To Reproduce

If you really felt like trying to reproduce the crash, you could download JsonTools v8.3.1 and try running the tests. The thing is, it might not cause a crash; I literally have no idea why the crash started happening.

But since I'm not asking you to change any functionality, I don't think it's that important that you be able to reproduce this.

Current Behavior

See above

Expected Behavior

No crash, obviously. But I'd be satisfied with a deprecation warning.

Debug Information

Notepad++ v8.7.4   (64-bit)
Build time : Dec  4 2024 - 23:50:05
Path : C:\Program Files\Notepad++\notepad++.exe
Command Line : 
Admin mode : OFF
Local Conf mode : OFF
Cloud Config : OFF
Periodic Backup : ON
Placeholders : OFF
DirectWrite : ON
Multi-instance Mode : monoInst
File Status Auto-Detection : cdEnabledNew (for current file/tab only)
Dark Mode : OFF
OS Name : Windows 10 Home (64-bit)
OS Version : 22H2
OS Build : 19045.5247
Current ANSI codepage : 1252
Plugins : 
    ColumnsPlusPlus (1.1.1)
    ComparePlus (1.1)
    CSharpPluginPack (0.0.3.18)
    CSVLint (0.4.6.7)
    EnhanceAnyLexer (1.1.3)
    HTMLTag (1.4.3.1)
    HugeFiles (0.4.1)
    JsonTools (8.3.1.3)
    mimeTools (3.1)
    NppConverter (4.6)
    NppExport (0.4)
    PythonScript (3.0.16)
    XMLTools (3.1.1.13)

Anything else?

No response

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions