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

Windows Communication DCB dismiss fOutxCtsFlow fOutxDsrFlow fOutX fInX etc field. #3158

Closed
Richyeoh opened this issue Jul 10, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@Richyeoh
Copy link

Suggestion

Windows Communication DCB dismiss fOutxCtsFlow fOutxDsrFlow fOutX fInX etc field.

@Richyeoh Richyeoh added the enhancement New feature or request label Jul 10, 2024
@Richyeoh
Copy link
Author

Richyeoh commented Jul 10, 2024

Here is winbase.h code

typedef struct _DCB {
  DWORD DCBlength;
  DWORD BaudRate;
  DWORD fBinary : 1;
  DWORD fParity : 1;
  DWORD fOutxCtsFlow : 1;
  DWORD fOutxDsrFlow : 1;
  DWORD fDtrControl : 2;
  DWORD fDsrSensitivity : 1;
  DWORD fTXContinueOnXoff : 1;
  DWORD fOutX : 1;
  DWORD fInX : 1;
  DWORD fErrorChar : 1;
  DWORD fNull : 1;
  DWORD fRtsControl : 2;
  DWORD fAbortOnError : 1;
  DWORD fDummy2 : 17;
  WORD  wReserved;
  WORD  XonLim;
  WORD  XoffLim;
  BYTE  ByteSize;
  BYTE  Parity;
  BYTE  StopBits;
  char  XonChar;
  char  XoffChar;
  char  ErrorChar;
  char  EofChar;
  char  EvtChar;
  WORD  wReserved1;
} DCB, *LPDCB;

Here is windows for rust code

#[repr(C)]
pub struct DCB {

    pub DCBlength: [u32](https://doc.rust-lang.org/nightly/std/primitive.u32.html),
    pub BaudRate: [u32](https://doc.rust-lang.org/nightly/std/primitive.u32.html),
    pub _bitfield: [u32](https://doc.rust-lang.org/nightly/std/primitive.u32.html),
    pub wReserved: [u16](https://doc.rust-lang.org/nightly/std/primitive.u16.html),
    pub XonLim: [u16](https://doc.rust-lang.org/nightly/std/primitive.u16.html),
    pub XoffLim: [u16](https://doc.rust-lang.org/nightly/std/primitive.u16.html),
    pub ByteSize: [u8](https://doc.rust-lang.org/nightly/std/primitive.u8.html),
    pub Parity: [DCB_PARITY](https://microsoft.github.io/windows-docs-rs/doc/windows/Win32/Devices/Communication/struct.DCB_PARITY.html),
    pub StopBits: [DCB_STOP_BITS](https://microsoft.github.io/windows-docs-rs/doc/windows/Win32/Devices/Communication/struct.DCB_STOP_BITS.html),
    pub XonChar: [i8](https://doc.rust-lang.org/nightly/std/primitive.i8.html),
    pub XoffChar: [i8](https://doc.rust-lang.org/nightly/std/primitive.i8.html),
    pub ErrorChar: [i8](https://doc.rust-lang.org/nightly/std/primitive.i8.html),
    pub EofChar: [i8](https://doc.rust-lang.org/nightly/std/primitive.i8.html),
    pub EvtChar: [i8](https://doc.rust-lang.org/nightly/std/primitive.i8.html),
    pub wReserved1: [u16](https://doc.rust-lang.org/nightly/std/primitive.u16.html),
}

@Nerixyz
Copy link
Contributor

Nerixyz commented Jul 10, 2024

It's packed in _bitfield - note that bitfields aren't supported yet: #2942.

@kennykerr
Copy link
Collaborator

Closing as duplicate of #2942

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants