Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question about marshaling #147

Open
fralik opened this issue Mar 11, 2020 · 0 comments · May be fixed by #148
Open

Question about marshaling #147

fralik opened this issue Mar 11, 2020 · 0 comments · May be fixed by #148

Comments

@fralik
Copy link

fralik commented Mar 11, 2020

I am trying to marshal the following call:

 unsigned long
 BaseInitiateShutdown(
     [ in, unique ] PREGISTRY_SERVER_NAME ServerName,
     [ in, unique ] PREG_UNICODE_STRING lpMessage,
     [ in ] unsigned long dwTimeout,
     [ in ] unsigned char bForceAppsClosed,
     [ in ] unsigned char bRebootAfterShutdown
     );

Is it the right thing to do it so:

private final WChar.NullTerminated serverName;
private final RPCUnicodeString.NullTerminated messageToUser;
private final long timeout;
private final boolean forceAppsClosed;
private final boolean rebootAfterShutdown;

public void marshal(PacketOutput packetOut) throws IOException {
    if (packetOut.writeReferentID(this.serverName)) {
        packetOut.writeMarshallable(serverName);
        packetOut.align(Alignment.FOUR);
    }
    // <NDR: struct> [in, unique] PREG_UNICODE_STRING lpMessage
    packetOut.writeMarshallable(this.messageToUser);
    packetOut.align(Alignment.EIGHT);

    // <NDR: unsigned long> [in] unisnged long dwTimeout
    packetOut.writeLong(timeout);
    
    // <NDR: unsigned char> [in] unsigned char bForceAppsClosed
    packetOut.writeBoolean(forceAppsClosed);
    
    // <NDR: unsigned char> [in] unsigned char bRebootAfterShutdown
    packetOut.writeBoolean(rebootAfterShutdown);
}

It seems like the first entity (serverName) writes OK, but the rest is not. Remote PC shuts down OK, but messageToUser and other parameters have no effect.

@fralik fralik linked a pull request Mar 22, 2020 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant